Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > Video stream recording
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #1  
Old 09-29-2015, 09:09 PM
sonnvl sonnvl is offline
Member
 
Join Date: May 2015
Posts: 34
sonnvl is on a distinguished road
Default

How to auto extract m3u8 and auto start recording


Is there any tool that auto extract m3u8 from a site and auto start recording that stream.
(Similar Jaksta recorder)

Eg. All below links contain m3u8 with variant token and I want to auto extract m3u8 list and auto start recording (using livestreamer of ffmpeg....)
http://tv.101vn.com/ok/vtc/youtv_2.php
http://viewtv.vn/live

Because I want to make task schedule to record at given time while I'm not online.

Thanks !
Reply With Quote
  #2  
Old 09-29-2015, 10:12 PM
biezom biezom is offline
Senior Member
 
Join Date: Sep 2014
Posts: 1,025
biezom is on a distinguished road
Default

Re: How to auto extract m3u8 and auto start recording


Quote:
Originally Posted by sonnvl View Post
Is there any tool that auto extract m3u8 from a site and auto start recording that stream.
(Similar Jaksta recorder)

Eg. All below links contain m3u8 with variant token and I want to auto extract m3u8 list and auto start recording (using livestreamer of ffmpeg....)
http://tv.101vn.com/ok/vtc/youtv_2.php
http://viewtv.vn/live

Because I want to make task schedule to record at given time while I'm not online.

Thanks !

with php code it's possible

Code:
<?php
$return=file_get_contents("http://tv.101vn.com/ok/vtc/youtv_2.php"); preg_match('/src=\'(.*?)\'/', $return, $matche);
$return2=file_get_contents("$matche[1]"); preg_match('/responseText = "(.*?)"/', $return2, $m3u8); $hls=str_replace("http","hlsvariant://http",$m3u8[1]);
$date = date("H:i_d-m-Y"); $outputfile= $date . "-hanoi-cab2.ts";
echo "Starting livestreamer...\n\n";
		echo shell_exec("livestreamer  \"$hls\" best -o \"$outputfile\" &");
		echo "Done.\n";
?>


Code:
<?php
$return=file_get_contents("http://viewtv.vn/live"); preg_match('/iosUrl =\'(.*?)\'/', $return, $m3u8);
$hls=str_replace("http","hlsvariant://http",$m3u8[1]); $date = date("H:i_d-m-Y"); $outputfile= $date . "-vt8.ts";
echo "Starting livestreamer...\n\n";
		echo shell_exec("livestreamer  \"$hls\" best -o \"$outputfile\" &");
		echo "Done.\n";
?>
Reply With Quote
  #3  
Old 09-30-2015, 12:13 AM
napretep napretep is offline
Member
 
Join Date: Sep 2014
Posts: 33
napretep is on a distinguished road
Default

Re: How to auto extract m3u8 and auto start recording


hi, the code you posted assumes livestreamer is in the same dir as php.exe, so I had to edit the path for livestreamer.

BUT how do u hard-interrupt the recording (force stop it)? Ctrl + C gives an error

Code:
php recme1.php

Warning: date(): It is not safe to rely on the system's timezone settings. You a
re *required* to use the date.timezone setting or the date_default_timezone_set(
) function. In case you used any of those methods and you are still getting this
 warning, you most likely misspelled the timezone identifier. We selected the ti
mezone 'UTC' for now, but please set date.timezone to select your timezone. in C
:\php\recme1.php on line 4
Starting livestreamer...

[download][..0-09-2015-hanoi-cab2.ts] Written 5.0 MB (32s @ 158.3 KB/s)        T
raceback (most recent call last):
  File "<string>", line 6, in <module>
  File "__main__.py", line 128, in <module>
^C
  File "__main__livestreamer__.py", line 9, in <module>
c:\php>^X  File "livestreamer_cli\main.py", line 890, in main
  File "livestreamer_cli\console.py", line 45, in msg
IOError: [Errno 22] Invalid argument
thanx
Reply With Quote
  #4  
Old 09-30-2015, 02:09 AM
biezom biezom is offline
Senior Member
 
Join Date: Sep 2014
Posts: 1,025
biezom is on a distinguished road
Default

Re: How to auto extract m3u8 and auto start recording


Quote:
Originally Posted by napretep View Post
hi, the code you posted assumes livestreamer is in the same dir as php.exe, so I had to edit the path for livestreamer.

BUT how do u hard-interrupt the recording (force stop it)? Ctrl + C gives an error

Code:
php recme1.php

Warning: date(): It is not safe to rely on the system's timezone settings. You a
re *required* to use the date.timezone setting or the date_default_timezone_set(
) function. In case you used any of those methods and you are still getting this
 warning, you most likely misspelled the timezone identifier. We selected the ti
mezone 'UTC' for now, but please set date.timezone to select your timezone. in C
:\php\recme1.php on line 4
Starting livestreamer...

[download][..0-09-2015-hanoi-cab2.ts] Written 5.0 MB (32s @ 158.3 KB/s)        T
raceback (most recent call last):
  File "<string>", line 6, in <module>
  File "__main__.py", line 128, in <module>
^C
  File "__main__livestreamer__.py", line 9, in <module>
c:\php>^X  File "livestreamer_cli\main.py", line 890, in main
  File "livestreamer_cli\console.py", line 45, in msg
IOError: [Errno 22] Invalid argument
thanx
for time zone warning you can download PHP.ini here

PHP.ini
and save it in php folder

to interrupt recording Ctrl+C several times or close command prompt

i think if you want to make task schedule you can create .bat file like this

Code:
@ echo on
call "C:\PHP\php.exe" "C:\php-scripts\recme1.php"
pause
:end
and use task scheduler but i'm not an expert on windows
Reply With Quote
  #5  
Old 09-30-2015, 03:47 AM
sonnvl sonnvl is offline
Member
 
Join Date: May 2015
Posts: 34
sonnvl is on a distinguished road
Default

Re: How to auto extract m3u8 and auto start recording


Thanks Biezom
What about this:
Code:
http://vuapp.tranvu.info/#tivi/173
Generate link:
Code:
http://vuapp.tranvu.info/api/channel/getnexttv?channel=5h503z5s5058553n5a6n786a5u715a765j3n5q6o6v6k5a46435z594759576z5d5h3c585ed645920e395fedad7bbbed0eca3fe2e05s56&token=313434313935333134385f305f305f776562&mobile=0
I grab this link:
Code:
http://125.212.201.169:1935/liveedge/_definst_/amlst:$vtc8$stream$_p2!250000!0!480!360$_p3!800000!0!640!480/playlist.m3u8?data=b00c5416ba2f281c2f01319e9e5e2d0236777e07b597de3ffd7bac0a06f5af0da96175989dd7e573ce85f6aac805a4ea&expired=1443608952362
But I want to change to get higher quality
Code:
http://125.212.201.169:1935/liveedge/_definst_/amlst:$vtc8$stream$_p5!800000!0!768!576/playlist.m3u8?data=b00c5416ba2f281c2f01319e9e5e2d0236777e07b597de3ffd7bac0a06f5af0da96175989dd7e573ce85f6aac805a4ea&expired=1443608952362
Can use php for this case ?
Reply With Quote
  #6  
Old 09-30-2015, 05:27 AM
biezom biezom is offline
Senior Member
 
Join Date: Sep 2014
Posts: 1,025
biezom is on a distinguished road
Default

Re: How to auto extract m3u8 and auto start recording


Quote:
Originally Posted by sonnvl View Post
Thanks Biezom
What about this:
Code:
http://vuapp.tranvu.info/#tivi/173
Generate link:
Code:
http://vuapp.tranvu.info/api/channel/getnexttv?channel=5h503z5s5058553n5a6n786a5u715a765j3n5q6o6v6k5a46435z594759576z5d5h3c585ed645920e395fedad7bbbed0eca3fe2e05s56&token=313434313935333134385f305f305f776562&mobile=0
I grab this link:
Code:
http://125.212.201.169:1935/liveedge/_definst_/amlst:$vtc8$stream$_p2!250000!0!480!360$_p3!800000!0!640!480/playlist.m3u8?data=b00c5416ba2f281c2f01319e9e5e2d0236777e07b597de3ffd7bac0a06f5af0da96175989dd7e573ce85f6aac805a4ea&expired=1443608952362
But I want to change to get higher quality
Code:
http://125.212.201.169:1935/liveedge/_definst_/amlst:$vtc8$stream$_p5!800000!0!768!576/playlist.m3u8?data=b00c5416ba2f281c2f01319e9e5e2d0236777e07b597de3ffd7bac0a06f5af0da96175989dd7e573ce85f6aac805a4ea&expired=1443608952362
Can use php for this case ?
yes for the php code

p5!800000!0!768!576 and _p3!800000!0!640!480 are the same quality BANDWIDTH=800000 just the radio change


Code:
<?php
$return=file_get_contents("http://vuapp.tranvu.info/#tivi/173"); preg_match('/token: "(.*?)"/', $return, $token);

$return2=file_get_contents("http://vuapp.tranvu.info/api/channel/info?id=173&token=$token[1]&mobile=0");

preg_match('/"link":"(.*?)"/', $return2, $channel);

$return3=file_get_contents("http://vuapp.tranvu.info/api/channel/getnexttv?channel=$channel[1]&token=$token[1]&mobile=0");
preg_match('/"url":"(.*?)"/', $return3, $m3u8);
$badformat = array('\\','u0026','_p2!250000!0!480!360$_p3!800000!0!640!480'); $goodformat = array("", "&",'_p5!800000!0!768!576'); $m3u8 = str_replace($badformat, $goodformat, $m3u8[1]);

$hls=str_replace("http","hlsvariant://http",$m3u8); $date = date("H:i_d-m-Y"); $outputfile= $date . "-vtc8.ts";
echo "Starting livestreamer...\n\n";
		echo passthru("livestreamer  \"$hls\" best -o \"$outputfile\" &");
		echo "Done.\n";
?>
Reply With Quote
Reply Post New Thread
Tags:



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 11:55 PM.


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons