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 > rtmpdump
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #41  
Old 11-18-2016, 12:44 PM
ihryjfbd ihryjfbd is offline
Senior Member
 
Join Date: Oct 2015
Posts: 212
ihryjfbd is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


Been a while since I used Delphi, do Delphi5 win32 exes still work on win10 x64?
Reply With Quote
  #42  
Old 11-18-2016, 04:44 PM
j_cool j_cool is offline
Senior Member
 
Join Date: Feb 2016
Posts: 515
j_cool is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


Good question.


I use delphi 7 to compile this.

Free pascal ( lazarus ) does not have clipbrd unit.


I cannot install delphi 7 on windows 7 so this is what I do:

install delphi 7 as minimal as you can on XP and manually backup ( copy )
command line compiler only. ( bin, lib, and 2 registry files )

registry files you "export" after minimal delphi installation:

[HKEY_LOCAL_MACHINE\SOFTWARE\Borland]

[HKEY_CURRENT_USER\Software\Borland]


This is content of "installation" pack:

Bin
Lib
hkcu.reg
hklm.reg
SETUP.bat

"Installation":

SETUP.bat:

xcopy *.* C:\"Program Files"\Borland\Delphi7 /S /I /Y
regedit /s hkcu.reg
regedit /s hklm.reg


Use:

D7.bat:

"C:\Program Files\Borland\Delphi7\BIN\DCC32.EXE" -cc %1
pause

Example:

C:\MISC\D7>D7 GINIKO_URL.dpr

C:\MISC\D7>"C:\Program Files\Borland\Delphi7\BIN\DCC32.EXE" -cc GINIKO_URL.dpr
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
GINIKO_URL.dpr(32) Warning: Text after final 'END.' - ignored by compiler
GINIKO_URL.dpr(48)
49 lines, 0.03 seconds, 318932 bytes code, 7873 bytes data.

C:\MISC\D7>pause
Press any key to continue . . .


Why not C, this would be the best ?

C code is not so appealing, though being the best and portable everywhere.

Last edited by j_cool : 11-18-2016 at 05:14 PM.
Reply With Quote
  #43  
Old 11-18-2016, 07:19 PM
j_cool j_cool is offline
Senior Member
 
Join Date: Feb 2016
Posts: 515
j_cool is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


Say that I need 1 day for each line of my proposed 4 line batch file ...

yes if I was superman.

This all has to be done invisible and to loop.

Now I look at 1st line "save web page as txt" and I look at curl...

xidel can do that but advanced use of xidel is beyond me.

Laj gave us:

http://www.filmon.com/api-v2/channel/694?protocol=hls

{"code":200,"message":"OK","data":{"id":694,"title ":"HRTV","alias":"hrtv","description":"HRTV is a 24-hour television based multimedia network dedicated to horseracing which features racing action from many of the sport's greatest racetracks around the world. HRTV also features other forms of equestrian competition, as well as original programming and award-winning documentaries covering a variety of racing and general equestrian topics.","group":"PAY TV - CHANNELS","group_id":37,"group_alias":"local-tv","type":"standard","is_free":false,"is_free_sd_ mode":false,"is_adult":false,"is_interactive":fals e,"is_vod":false,"is_vox":false,"is360":false,"wat ch_free_time":0,"is_local":false,"seekable":false, "user_subscribed":false,"streams":[{"is_free":false,"name":"694.low.stream/playlist.m3u8","quality":"low","url":"http://live-1130.la2.edge.filmon.com/live/694.low.stream/playlist.m3u8?id=035bca1a71b11fce016d28acd3dbea51c bc96ddfe5b9ed3f8fe3286df6a738d313d6ee9ef0cd5913441 8dd131ea7d6f1505c1fa252b971687a03a80768d72df2eb43c 3ad52f2074a9d2e866386b2cbd210b026183061ebc1209f59c 8f54e2b3e24fe3c5610d8ff2ceb083195d6eb35a3f6caf93a5 d3823e634553ad05fe097d6239b7cc1d02facffadc29e53472 de0d0b394a5969c670636","watch-timeout":0},{"is_free":false,"name":"694.high.stre am/playlist.m3u8","quality":"high","url":"http://live-1130.la2.edge.filmon.com/live/694.high.stream/playlist.m3u8?id=035bca1a71b11fce016d28acd3dbea51c bc96ddfe5b9ed3f8fe3286df6a738d313d6ee9ef0cd5913441 8dd131ea7d6f1505c1fa252b971687a03a80768d72df2eb43c 3ad52f2074a9d2e866386b2cbd210b026183061ebc1209f59c 8f54e2b3e24fe3c5610d8ff2c0df2bff6addd1a2e611d4feb2 36ac885ae2166ed75436089691b5025580d1a9e3388a47587c 054d5e7eb443464f249ca","watch-timeout":0}],"server_time":1479517803}}

the most efficient use of this would be to set ID variable in batch file as output from curl or xidel.

I don't know how (to get ID with curl) so I will save this as txt file, read txt file and send ID to clipboard, read from clipboard, snail mail.

Last edited by j_cool : 11-18-2016 at 08:24 PM.
Reply With Quote
  #44  
Old 12-30-2016, 12:40 PM
j_cool j_cool is offline
Senior Member
 
Join Date: Feb 2016
Posts: 515
j_cool is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


Laj,

are you still alive and well?

Here are HRTV chunks recorded in sequence one after the other.


@title hrtvRDump.bat
:START
@if "%time:~0,1%" == " " (set d=%date:~-4%-%date:~3,2%-%date:~0,2%_0%time:~1,1%-%time:~3,2%-%time:~6,2%) ^
else (set d=%date:~-4%-%date:~3,2%-%date:~0,2%_%time:~0,2%-%time:~3,2%-%time:~6,2%)
@FOR /f %%x IN ('HRTV.exe') DO @set var=%%x
rtmpdump.exe -v -r %var% -o %d%_hrtv.flv
@FOR %%I in (%d%_hrtv.flv) do @if %%~zI LSS 1 del "%%I"
:LOOP
@FOR /f %%a IN ('HRTV.exe') DO @set var2=%%a
if "%var%"=="%var2" goto LOOP
goto START


For this to work you need these files in the same location or on the path:

hrtvrdump.bat
hrtv.exe
curl.exe
rtmpdump.exe


hrtv.au3:

RunWait( 'cmd.exe /c curl -A Mozilla/5.0 -s http://www.filmon.com/api-v2/channel/694?protocol=rtmp | CLIP','', @SW_HIDE )
$sData = ClipGet()
$first = StringInStr( $sData, '"quality":"high","url":"' ) + 23
$sData = StringTrimLeft( $sData, $first )
$last = StringLen( $sData ) - ( StringInStr( $sData, '","watch-timeout":0}]' ) - 1 )
$sData = StringTrimRight( $sData, $last ) & '/694.high.stream'
ConsoleWrite( $sData & @CRLF )


you need to compile .au3 with autoit to get .exe

Aut2Exe.exe /in hrtv.au3

https://www.autoitscript.com/site/autoit/downloads/

autoit-v3.zip

If you want to see the output from hrtv.exe on its own you need to enter on command line: hrtv|more



curl:

http://www.paehl.com/open_source/?CURL_7.51.0

curl_751_0.zip


After you run hrtvrdump.bat for some time you will find chunks looking like this:

2016-12-30_17-24-14_hrtv.flv
2016-12-30_17-26-22_hrtv.flv
2016-12-30_17-28-31_hrtv.flv
2016-12-30_17-30-37_hrtv.flv
2016-12-30_17-32-46_hrtv.flv

you can concatenate them and get continuous stream.


You can play the stream directly, player will be restarting every 2 minutes,
.bat file looping sometimes until the next chunk starts.


@title hrtvFF.bat
:START
@FOR /f %%x IN ('HRTV.exe') DO @set var=%%x
rtmpdump.exe -v -r %var% |ffplay.exe -autoexit -
:LOOP
@FOR /f %%a IN ('HRTV.exe') DO @set var2=%%a
if "%var%"=="%var2" goto LOOP
goto START


This can be improved upon if we knew how to get rtmpdump or ffmpeg
keep appending chunks instead of overwriting them, other members welcome with feedback.

Last edited by j_cool : 12-31-2016 at 01:26 AM. Reason: @FOR %%I in (c:\%d%_hrtv.flv) do @if %%~zI LSS 1 del "%%I" c:\ was if you run this in c:\, would not work in another location
Reply With Quote
  #45  
Old 01-02-2017, 10:29 PM
lajvguy lajvguy is offline
Senior Member
 
Join Date: Nov 2014
Posts: 203
lajvguy is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


Quote:
Originally Posted by j_cool View Post
Laj,

are you still alive and well?

Here are HRTV chunks recorded in sequence one after the other.


@title hrtvRDump.bat
:START
@if "%time:~0,1%" == " " (set d=%date:~-4%-%date:~3,2%-%date:~0,2%_0%time:~1,1%-%time:~3,2%-%time:~6,2%) ^
else (set d=%date:~-4%-%date:~3,2%-%date:~0,2%_%time:~0,2%-%time:~3,2%-%time:~6,2%)
@FOR /f %%x IN ('HRTV.exe') DO @set var=%%x
rtmpdump.exe -v -r %var% -o %d%_hrtv.flv
@FOR %%I in (%d%_hrtv.flv) do @if %%~zI LSS 1 del "%%I"
:LOOP
@FOR /f %%a IN ('HRTV.exe') DO @set var2=%%a
if "%var%"=="%var2" goto LOOP
goto START


For this to work you need these files in the same location or on the path:

hrtvrdump.bat
hrtv.exe
curl.exe
rtmpdump.exe


hrtv.au3:

RunWait( 'cmd.exe /c curl -A Mozilla/5.0 -s http://www.filmon.com/api-v2/channel/694?protocol=rtmp | CLIP','', @SW_HIDE )
$sData = ClipGet()
$first = StringInStr( $sData, '"quality":"high","url":"' ) + 23
$sData = StringTrimLeft( $sData, $first )
$last = StringLen( $sData ) - ( StringInStr( $sData, '","watch-timeout":0}]' ) - 1 )
$sData = StringTrimRight( $sData, $last ) & '/694.high.stream'
ConsoleWrite( $sData & @CRLF )


you need to compile .au3 with autoit to get .exe

Aut2Exe.exe /in hrtv.au3

https://www.autoitscript.com/site/autoit/downloads/

autoit-v3.zip

If you want to see the output from hrtv.exe on its own you need to enter on command line: hrtv|more



curl:

http://www.paehl.com/open_source/?CURL_7.51.0

curl_751_0.zip


After you run hrtvrdump.bat for some time you will find chunks looking like this:

2016-12-30_17-24-14_hrtv.flv
2016-12-30_17-26-22_hrtv.flv
2016-12-30_17-28-31_hrtv.flv
2016-12-30_17-30-37_hrtv.flv
2016-12-30_17-32-46_hrtv.flv

you can concatenate them and get continuous stream.


You can play the stream directly, player will be restarting every 2 minutes,
.bat file looping sometimes until the next chunk starts.


@title hrtvFF.bat
:START
@FOR /f %%x IN ('HRTV.exe') DO @set var=%%x
rtmpdump.exe -v -r %var% |ffplay.exe -autoexit -
:LOOP
@FOR /f %%a IN ('HRTV.exe') DO @set var2=%%a
if "%var%"=="%var2" goto LOOP
goto START


This can be improved upon if we knew how to get rtmpdump or ffmpeg
keep appending chunks instead of overwriting them, other members welcome with feedback.
Hey j cool,

Does it really work? Looks complicated. Thanks for the help!
Reply With Quote
  #46  
Old 01-03-2017, 03:12 AM
j_cool j_cool is offline
Senior Member
 
Join Date: Feb 2016
Posts: 515
j_cool is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


This is ongoing work. You get chunks as I said.

If this worked for private shows on webcam sites it would be the biggest hit on this forum.

You have noticed well that it is not something sophisticated.

Idea of this is to see how it works and improve.

Improvement is not packing it all up in one EXE with autoit at this stage but get the stream play continuously with the player first.

Without the URL you posted I could not had started anything with HRTV and here are chunks for the start.

My Quote:

This can be improved upon if we knew how to get rtmpdump or ffmpeg
keep appending chunks instead of overwriting them, other members welcome with feedback.

Last edited by j_cool : 01-03-2017 at 05:31 AM.
Reply With Quote
  #47  
Old 01-04-2017, 01:10 AM
ihryjfbd ihryjfbd is offline
Senior Member
 
Join Date: Oct 2015
Posts: 212
ihryjfbd is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


You might be able do it with a delayed loop or something

Create clip list file
Code:
(for %%i in (*.flv) do @echo file '%%i') > mylist.txt
Join all clips together once the stream has ended
Code:
ffmpeg -f concat -i mylist.txt -c copy output.flv
The thing is though even when you join files there's an offset between the two files because the second clip contains around 1-2 seconds from previous clip as it's starting point so you need to trim them otherwise you'll get jumps.
Reply With Quote
  #48  
Old 01-04-2017, 04:41 AM
j_cool j_cool is offline
Senior Member
 
Join Date: Feb 2016
Posts: 515
j_cool is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


We will have to live with that jump between chunks.

You must be real hacker to get this playing straight.

If I can get the stream recorded as one continuous file it can be opened with player and played "as it goes".

( maybe piped without writting to disk )

Concatenating chunks "as it goes" makes that impossible.

There are more people working on ffmpeg than on rtmpdump, and if ffmpeg does not offer --append switch
it must be something hard to implement.

I do something similar to what you propose.



Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\dir /b /on /a-d > DIR.txt\command]
@="cmd.exe /c dir /b /on /a-d > DIR.txt"


Right click on any directory in "windows explorer" LEFT pane and get this option:

dir /b /on /a-d > DIR.txt

this gives me DIR.txt:

( go manually through DIR.txt and weed out what I need to concatenate )

2017-01-04_09-49-23_HRTV.flv
2017-01-04_09-49-55_HRTV.flv
2017-01-04_09-52-02_HRTV.flv
2017-01-04_09-54-10_HRTV.flv
2017-01-04_09-56-18_HRTV.flv
2017-01-04_09-58-27_HRTV.flv
2017-01-04_10-00-33_HRTV.flv
2017-01-04_10-02-42_HRTV.flv
2017-01-04_10-04-50_HRTV.flv


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\txtfile\Shell\concat.txt\command]
@="C:\\ap\\concat.exe %1"


Right click on DIR.txt
"drop down" menu shows this option:

concat.txt

This gives me concat.txt:

file '2017-01-04_09-49-23_HRTV.flv'
file '2017-01-04_09-49-55_HRTV.flv'
file '2017-01-04_09-52-02_HRTV.flv'
file '2017-01-04_09-54-10_HRTV.flv'
file '2017-01-04_09-56-18_HRTV.flv'
file '2017-01-04_09-58-27_HRTV.flv'
file '2017-01-04_10-00-33_HRTV.flv'
file '2017-01-04_10-02-42_HRTV.flv'
file '2017-01-04_10-04-50_HRTV.flv'


program concat;
{$APPTYPE CONSOLE}
uses sysutils;
var s,s2: string;
f,f2: text;

function filename(s:string): string; // CmdLine; //"C:\AP\mka.exe" "C:\New Text Document.mkv"
var str,str1: string; i: integer;
begin
str:='';
for i:= length( s ) downto 1 do
begin
if s[ i ] = '\' then break;
if s[ i ] <> '"' then str:= str + s[ i ]; // txt.ecnerefeR egaugnaL ihpleD
end;
str1 :='';
for i:= length( str ) downto 1 do str1:= str1 + str[ i ]; // Delphi Language Reference.txt
filename:= str1;
end;

begin
assign( f,filename(cmdline) );
reset( f );
rewrite( f2,'concat.txt' );
while not eof( f ) do
begin
readln( f,s );
s2:= 'file ' + chr(39) + s + chr(39);
if length( s ) > 0 then writeln( f2,s2 );
end;
close( f );
close( f2 );
end.


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\txtfile\Shell\FMPEG concat.txt\command]
@="C:\\AP\\FF\\ffmpeg.exe -f concat -i %1 -c copy concat.flv"


Right click on concat.txt
"drop down" menu shows this option:

FMPEG concat.txt

And here is my:

concat.flv


Ignore yellow lines in CMD window, takes some time to run.

Last edited by j_cool : 01-04-2017 at 07:01 PM.
Reply With Quote
  #49  
Old 01-04-2017, 05:36 AM
j_cool j_cool is offline
Senior Member
 
Join Date: Feb 2016
Posts: 515
j_cool is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


Ihry,

I was thinking about the gap between chunks.

I was not sure about how much we are missing there and you made it clear that it is nothing missing there but extra 1 sec or 2.

That can be trimmed before concatenation.

Somebody may answer how to know the number of extra seconds ( when is 1, when are 2 ) or how to find it out.

Jumps would irritate if that were few seconds chunks.

In 2 minutes chunks I personally don't mind the jump.

Some beta or irregular release of rtmpdump or ffmpeg that would write those 2 minutes chunks to ONE FILE without overwriting would work fine for me.

Last edited by j_cool : 01-04-2017 at 11:25 AM.
Reply With Quote
  #50  
Old 01-04-2017, 07:53 PM
ihryjfbd ihryjfbd is offline
Senior Member
 
Join Date: Oct 2015
Posts: 212
ihryjfbd is on a distinguished road
Default

Re: Can somebody help get filmon rtmp code to play with livestreamer?


The chunk overlap time seems to be the time taken to connect to the next stream clip in the sequence, you could probably dump a timed value into a txt file by setting timer to start on rtmp starting and then ending when the clip being is written to the hdd.


set time_start=%time%
set time_end=%time%
set time_taken=%time_end%-%time_start%
echo time_taken
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 06:07 AM.


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