Re: Transcoding live streams question

2015-06-04 Thread Vangelis forthnet
On Thu Jun 4 22:37:46 BST 2015, iz wrote: 

I found that I could use 
--hls-livetv-opts="-acodec copy -vcodec copy" 
to override the transcoding.


Hello :-) 
This is a most important find! 
I haven't really experimented with LiveTV inside GiP, 
(I am legally off-limits), the very little tests I conducted 
were via standalone FFmpeg commands for "academic" 
purposes... 
I am aware of the analogous radio option,

--hls-liveradio-opts
but it only relates to re-muxing, since liveradio (AppleHLS 
streams) does not need recoding - so my mind did not go  
to "--hls-livetv-opts" which indeed, according to --helplong:


"Add custom options to ffmpeg HLS download encoding for livetv"

But, of course, your FFmpeg binary should support 
"-c:v copy -c:a copy" for the LiveTV HLS streams; 
have you updated yours manually?


@ John Warburton:
Looks like you won't have to edit the main script manually!

Many cheers, iz!
Vangelis.

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: Transcoding live streams question

2015-06-04 Thread iz
On Thu Jun 4 11:02:28 BST 2015, John Warburton wrote:
> 
> (1) am I neglecting a command-line option to do this,

I found that I could use --hls-livetv-opts="-acodec copy -vcodec copy" to 
override the transcoding.


___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: Transcoding live streams question

2015-06-04 Thread John Warburton
Thank you. That's a very helpful explanation.

I compile FFmpeg freshly nearly every day, and use the mpv player that
links to the latest compiled libav... libraries, and it always works
very well, as you have found with your own recent builds of FFmpeg. It
helps to tell mpv to use a much larger than default cache.

The set-up here is good, with great pictures, so we're happy :-)
with best wishes,
J

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Re: Transcoding live streams question

2015-06-04 Thread Vangelis forthnet

On Thu Jun 4 11:02:28 BST 2015, John Warburton wrote:


I remove the default ffmpeg recoding for live streams.
(snip)
because picture quality suffers and the CPU is exercised more.


This is called on-the-fly recoding, and it's a CPU intensive process...
Low end devices can't cope well, see:

https://github.com/get-iplayer/get_iplayer/wiki/release291#caveats-1
[quote]
This requires more system resources than merely copying streams over the 
network.
...If your system lacks the necessary horsepower, you may find glitches or 
gaps

[/quote]


(1) am I neglecting a command-line option to do this,


Am afraid you're not!


(2) is there a reason for this recoding that has escaped me?


The HLS streamer class was added in GiP initially in late Nov 2014,
as a means to bring back live TV; the beeb had previously removed
the online resources GiP depended upon to generate the live TV
RTMP streams (themselves killed off some time later...).

http://git.infradead.org/get_iplayer.git/commit/9819c0337d5998906d6b6ea6b2d85f74dbb348ea
[quote]
Live TV HLS streams must be re-encoded because
pts/dts differences will kill ffmpeg.
[/quote]
Also, from the wiki link I referenced above:
[quote]
The live TV streams are re-encoded during download
due to problems with timestamp discontinuities in the video stream.
[/quote]

The "will kill ffmpeg" bit is indeed true on Win32 (my OS)
for ffmpeg versions older than the 2.5 branch;
I did conduct some tests back then, trying
the Limelight CDN for BBC One (London), using the command:

ffmpeg -re -i 
http://vs-hds-uk-live.bbcfmt.vo.llnwd.net/pool_5/live/bbc_one_london/bbc_one_london.isml/bbc_one_london-audio_1=128000-video=1374000.m3u8 - 
t 60 -c:v copy -c:a copy -bsf:a aac_adtstoasc bbc1live.mp4


and these are my findings:
FFmpeg
1.2.11:
pts (3600) < dts (7200) in stream 0
av_interleaved_write_frame(): Invalid argument
NO DOWNLOAD

2.2.11:
[mp4 @ 00f5e820] Invalid DTS: 7200 PTS: 3600 in output stream 0:0
[mp4 @ 00f5e820] Application provided invalid, non monotonically increasing 
dts

to muxer in stream 0: 3600 >= NOPTS
av_interleaved_write_frame(): Invalid argument
NO DOWNLOAD

2.4.4:
[mp4 @ 00b6ee60] Invalid DTS: 7200 PTS: 3600 in output stream 0:0
[mp4 @ 00b6ee60] Application provided invalid, non monotonically increasing 
dts

to muxer in stream 0: 3600 >= NOPTS
av_interleaved_write_frame(): Invalid argument
NO DOWNLOAD

2.5.x
[mpegts @ 05829ee0] Invalid DTS: 531 PTS: 5306400 in output stream 0:0, 
replacing by guess

SUCCESSFUL  DOWNLOAD,
but the command prompt window is littered
with a constant display of the above warning -
I had to add "-loglevel 16" to the command
and the 1min recording completed successfully
with negligible CPU usage...(~ 10 %).
(Please read a related post of mine here:
http://lists.infradead.org/pipermail/get_iplayer/2015-March/007414.html).

So, if a current (fresh) build of ffmpeg is used,
GiP could be modified to not use recoding
for the live TV streams (over AppleHLS).
However, the latest Win setup still fetches FFmpeg 2.2.3!

Hope you got your answer.
Regards. 



___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer


Transcoding live streams question

2015-06-04 Thread John Warburton
Hello,

Many, many thanks to all who contributed to restoring get_iplayer. I
mentioned elsewhere that my old machine's graphics card can't use
hardware acceleration from the browser-based iPlayer, but piping
get_iplayer.pl into the mpv player gives me smooth pictures at
1280x720 expanded to full screen every time. We use get_iplayer every
day for this kind of thing at home.

With every iteration of get_iplayer, I remove the default ffmpeg
recoding for live streams. This is switched off manually within the
Perl code by me (patch below) because picture quality suffers and the
CPU is exercised more.

But I wonder: (1) am I neglecting a command-line option to do this,
and (2) is there a reason for this recoding that has escaped me?

--- ./orig/get_iplayer.pl2015-06-03 15:47:12.428924100 +0100
+++ ./patched/get_iplayer.pl 2015-06-03 13:07:23.981928400 +0100
@@ -10464,7 +10464,7 @@
push @cmdopts, ( '-vb', "${vb}k" ) if $vb;
#push @cmdopts, ( '-vcodec', 'h264' );
push @cmdopts, ( '-ab', "${ab}k" ) if $ab;
-   push @cmdopts, ( '-acodec', 'aac', '-strict',
'experimental' );
+   push @cmdopts, ( '-acodec', 'copy', '-vcodec',
'copy', '-strict', 'experimental' );
} else {
push @cmdopts, ( '-vn' );
push @cmdopts, ( '-acodec', 'copy' );

___
get_iplayer mailing list
get_iplayer@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/get_iplayer