rem @echo off

rem "C:\Program Files\PS3 Media Server v1.50.1\PS3 Media Server\win32\ffmpeg-RZ.exe"   
rem -user-agent Firefox/26.0 -threads 4 -ss 0.0  -i https://manifest.googlevideo.com/api/manifest/hls_playlist/id/qmwlvPeBRC4.163/itag/95/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/itag%3D140/sgovp/itag%3D136/hls_chunk_host/r3---sn-oguelne7.googlevideo.com/gcr/jp/playlist_type/LIVE/mm/32/mn/sn-oguelne7/ms/lv/mv/u/nh/IgpwcjAzLm5ydDEwKgkxMjcuMC4wLjE/pl/24/dover/3/upn/dG6-YyoNGCI/fexp/9410706,9416126,9416891,9417380,9422342,9422596,9426736,9427789,9428398,9431012,9432058,9432365,9433096,9433223,9433946,9435328,9435396,9435527,9435693,9435876,9436020,9436606,9437157,9437403,9437738/sver/3/mt/1464251335/ip/219.162.37.218/ipbits/0/expire/1464273196/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,gcr,playlist_type,mm,mn,ms,mv,nh,pl/signature/4F7CC0BCBFAEADB9D9C234423AA2AFE5448B6EA5.87B62BBF34AED4E77A7F8E90323E79E3BCB95C52/key/dg_yt0/playlist/index.m3u8  -f vob -vcodec mpeg2video -q:v 1 -acodec ac3 -ab 448000 -ar 48000 -vf scale=1280:720,pad=1280:720:0:0 -aspect 4/3 -async 10 -loglevel fatal -y \\.\pipe\mencoder1464251390597.mpg

cd ../../../
set bdir="C:/Program Files/PS3 Media Server v1.50.1/PS3 Media Server/regzamod/RzWEBplayer"

rem % in url must be escaped to %%
rem ---- youtube live
set url_ytb="https://manifest.googlevideo.com/api/manifest/hls_playlist/id/qmwlvPeBRC4.163/itag/95/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/itag%%3D140/sgovp/itag%%3D136/hls_chunk_host/r3---sn-oguelne7.googlevideo.com/gcr/jp/playlist_type/LIVE/mm/32/mn/sn-oguelne7/ms/lv/mv/u/nh/IgpwcjAzLm5ydDEwKgkxMjcuMC4wLjE/pl/24/dover/3/upn/dG6-YyoNGCI/fexp/9410706,9416126,9416891,9417380,9422342,9422596,9426736,9427789,9428398,9431012,9432058,9432365,9433096,9433223,9433946,9435328,9435396,9435527,9435693,9435876,9436020,9436606,9437157,9437403,9437738/sver/3/mt/1464251335/ip/219.162.37.218/ipbits/0/expire/1464273196/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,gcr,playlist_type,mm,mn,ms,mv,nh,pl/signature/4F7CC0BCBFAEADB9D9C234423AA2AFE5448B6EA5.87B62BBF34AED4E77A7F8E90323E79E3BCB95C52/key/dg_yt0/playlist/index.m3u8"

set temp1="C:\Users\papas\AppData\Local\Temp\pms_for_regza"
rem ---- ustream live
set url_ust="http://www.ustream.tv/channel/narita-live-asahi-north-camera"
set url_ust="http://www.ustream.tv/channel/mm-taro"
set url_ust="http://www.filmon.com/tv/studio-girls"

set url=%url_ytb%
set url=%url_ust%
set bgm="C:/Program Files/PS3 Media Server v1.50.1/PS3 Media Server/regzamod/RzWEBplayer/test/PolyLithm.mp3"
set clippath="C:\Users\papas\AppData\Local\Temp\pms_for_regza\clips\Dance_hash_-1669636354.lst"
set clippath="C:\Users\papas\AppData\Local\Temp\pms_for_regza\clips\ŽR‰º’B˜Y_hash_-1339733698.lst"
set clippath="C:\Users\papas\AppData\Local\Temp\pms_for_regza\clips\ROHAN_hash_648391828.lst"

set video_out=out.mpg

rem ---- Option for Re-connect when Once opened connection closed in short time, like as filmON site
rem reconnect=0: no re-connect
rem reconnect=1: re-connect only for www.filmon.com
rem reconnect=2: re-connect for any site

rem ---- Option for proc_type of transcode-pipeline
rem ---- valid only [None or proc_type=3] for RzLivePlayer_m
rem proc_type=1: force ffmpeg only
rem proc_type=2: force ffmpeg+youtube-dl 
rem proc_type=3: force ffmpeg+livestreamer

set test_opt=
set test_opt=--reconnect 2 --opt_str "proc_type=3"


rem C:/Python27/python.exe %bdir%/RzLivePlayer_m.py %url% %video_out% --bgm 1 --clippath_a %clippath% --temp %temp1% --sess_id 0 
C:/Python27/python.exe %bdir%/RzLivePlayer_m.py %url% %video_out% %test_opt% --bgm 1 --clippath_a %clippath% --temp %temp1% --sess_id 0 

pause