Re: Using ffmpeg to halve frame rate
On 17/04/18 22:27, Nick Payne wrote: I just ran another test on some 1280x720 50fps and 1280x720 25fps downloads from the last UK snooker championship. As before, the 25fps downloads were reduced to about 1/3 previous size by Handbrake (eg a 4h58m match that was 5.03Gb came down to 1.55Gb). However, the 50fps downloads were reduced by far more with exactly the same settings in Handbrake - for example, a 4h44m match that was a 10.2Gb download from GiP came down to 1.48Gb, and a 4h14m 8.93Gb file came down to 1.30Gb. This leads me to wonder if the 50fps downloads are from a 25fps original and just have each frame duplicated, as after running through Handbrake, the file sizes just seem proportional to the length of the program, and whether 50fps or 25fps has no effect on the file size. That's interesting. I did wonder how the BBC was generating its 50fps material. It seemed surprising that it would shoot all its material at a higher frame rate than broadcast just for the benefit of the iPlayer. If I want to achieve a 50fps frame rate by duplicating frames I can do that myself. For the BBC to duplicate frames is a waste of everyone's time and bandwidth. Best wishes Richard ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On 16/04/2018 6:59 AM, Nick Payne wrote: > On 16/04/2018 2:18 AM, RS wrote: >> A couple of years ago there were problems with HLS and there was >> speculation that we might have 50 fps HVFhd and DVFhd as the only HD >> modes. At that time I wondered if it would be feasible to drop every >> other frame to reduce the frame rte to 25 fps. I thought because of >> the H.264 delta encoding it would probably mean transcoding and that >> it would be too slow. >> >> On a 42" screen for the programmes that I usually watch I cannot see >> any difference between a HD picture at 50 fps and one at 25 fps, so 50 >> fps for me is just a waste of bandwidth and storage space, so I have >> been looking at it again. > I experimented a while ago with running some GiP downloads through > Handbrake to convert the video to the x265 codec. That reduced the file > size to about 1/3 of the original download, with no subjective > difference in video quality that I could see when viewing on our TV. A > one hour 1280x720 25fps program that downloads as a 1Gb file was reduced > in size to ~350Mb. On my PC, the re-encode runs at about 50fps for > 1280x720, so ~2x real time for 25fps and ~real time for 50fps. For > smaller video dimension such as 960x540, the re-encode speed was around > 85-90FPS. I just ran another test on some 1280x720 50fps and 1280x720 25fps downloads from the last UK snooker championship. As before, the 25fps downloads were reduced to about 1/3 previous size by Handbrake (eg a 4h58m match that was 5.03Gb came down to 1.55Gb). However, the 50fps downloads were reduced by far more with exactly the same settings in Handbrake - for example, a 4h44m match that was a 10.2Gb download from GiP came down to 1.48Gb, and a 4h14m 8.93Gb file came down to 1.30Gb. This leads me to wonder if the 50fps downloads are from a 25fps original and just have each frame duplicated, as after running through Handbrake, the file sizes just seem proportional to the length of the program, and whether 50fps or 25fps has no effect on the file size. Nick ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On 16/04/18 09:27, Nick Payne wrote: On 16/04/2018 5:21 PM, Steve Dodd wrote: On Sun, Apr 15, 2018 at 9:59 PM, Nick Payne wrote: I experimented a while ago with running some GiP downloads through Handbrake to convert the video to the x265 codec. That reduced the file size to about 1/3 of the original download, with no subjective difference in video quality that I could see when viewing on our TV. Figures - most of the comparison work done on H.265 v. H.264 says you should get same subjective quality for half the bitrate. A one hour 1280x720 25fps program that downloads as a 1Gb file was reduced in size to ~350Mb. On my PC, the re-encode runs at about 50fps for 1280x720, so ~2x real time for 25fps and ~real time for 50fps. For smaller video dimension such as 960x540, the re-encode speed was around 85-90FPS. Do you know what x265 quality setting you used? I'm also experimenting now it seems HLSHD is being turned off (series 2 of Salamander has HVF only so far).. RF17 seems to be spitting about half the bitrate of the BBC h.264 output, and running at ~40fps which I can live with (Core i5-6500). Noticeable quality difference still when looking at stills, but have tried watching it moving yet.. For re-encoding 1280x720 downloads to x265, on the Video tab in Handbrake I have the encoder preset at "Faster" and the RF quality at 23. I tried using ffmpeg and the libx265 codec with default quality (CRF=28?) on HVFhd. I only did half a minute because it was so slow. It is convenient to do it on this machine, but it has only got a 2.3GHZ Core 2 duo. I set -r=25 to reduce the frame rate to 25fps by dropping alternate frames. It confirmed that dropping frames worked, and I did not notice any problems as a result. It only processed 2 frames a second, so an hour's recording would take 12 hours! I'll have to try it on my latest laptop which has a core i5-7200U. Best wishes Richard ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On 15/04/18 17:47, Anthony Kehoe wrote: I actually worked on this on Friday. I do a lot of work with ffmpeg to get encodes working nicely with my 4K telly along with putting things in iTunes for the AppleTVs. I added a new option for my copy of get_iplayer, akfps, that changes the ffmpeg resolutions should a 50fps version be downloaded. # Recording akfps => [ 1, "akfps!", 'Recording', '--akfps', "AK: Turn on ffmpeg override for 50fps to 25fps conversion"], Down in sub postproc, I modified the section where @codec_opts builds the video/audio codec options. I looked at a few BBC encodes and it seems like they use a bitrate around 2285 with a maxrate of 3500 for hls streams: Bit rate mode: Variable Bit rate : 2 335 kb/s Maximum bit rate : 3 500 kb/s Width: 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 FPS Therefore, I used a target bitrate of 2285 with a maximum of 3500. Thanks, that's useful. -b:v=2285k does indeed give me the bit rate I was expecting. For the moment I want to try to reduce the frame rate by dropping alternate frames as that should avoid any loss of quality in re-encoding. Also I want to be able to do it in a reasonable time on this ancient desktop which has a 2.3GHz Core 2 duo. I gather -r in ffmpeg does not work with -c copy. According to this article there is a workaround by concatenating a dummy file at the beginning to set the PTS value. I'll give it a try. https://superuser.com/questions/1088382/change-framerate-in-ffmpeg-without-reencoding Best wishes Richard ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On 16/04/18 08:21, Steve Dodd wrote: > > Incidentally, has anyone else noticed HE-AAC coming through in the > downloads recently? > Another advantage of HLShd was that there was no HE-AAC when the audio was 96kbit/s. HVF has used HE-AAC with 96kbit/s audio for some time, but only at the lower resolutions. I have not seen 96kbit/s audio and HE-AAC at the higher HVF resolutions like HVFhd, HVFsd and HVFxsd. I have only seen those resolutions with 128kbit/s or higher audio (usually 320kbit/s). As for DVF, I have not used it enough to be able to comment. Have you seen HE-AAC with the higher resolutions? Best wishes Richard ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On 16/04/2018 5:21 PM, Steve Dodd wrote: > On Sun, Apr 15, 2018 at 9:59 PM, Nick Payne wrote: > >> I experimented a while ago with running some GiP downloads through >> Handbrake to convert the video to the x265 codec. That reduced the file >> size to about 1/3 of the original download, with no subjective >> difference in video quality that I could see when viewing on our TV. > Figures - most of the comparison work done on H.265 v. H.264 says you > should get same subjective quality for half the bitrate. > >> A one hour 1280x720 25fps program that downloads as a 1Gb file was reduced >> in size to ~350Mb. On my PC, the re-encode runs at about 50fps for >> 1280x720, so ~2x real time for 25fps and ~real time for 50fps. For >> smaller video dimension such as 960x540, the re-encode speed was around >> 85-90FPS. > Do you know what x265 quality setting you used? I'm also experimenting > now it seems HLSHD is being turned off (series 2 of Salamander has HVF > only so far).. RF17 seems to be spitting about half the bitrate of the > BBC h.264 output, and running at ~40fps which I can live with (Core > i5-6500). Noticeable quality difference still when looking at stills, > but have tried watching it moving yet.. For re-encoding 1280x720 downloads to x265, on the Video tab in Handbrake I have the encoder preset at "Faster" and the RF quality at 23. Nick ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On Sun, Apr 15, 2018 at 9:59 PM, Nick Payne wrote: > I experimented a while ago with running some GiP downloads through > Handbrake to convert the video to the x265 codec. That reduced the file > size to about 1/3 of the original download, with no subjective > difference in video quality that I could see when viewing on our TV. Figures - most of the comparison work done on H.265 v. H.264 says you should get same subjective quality for half the bitrate. > A one hour 1280x720 25fps program that downloads as a 1Gb file was reduced > in size to ~350Mb. On my PC, the re-encode runs at about 50fps for > 1280x720, so ~2x real time for 25fps and ~real time for 50fps. For > smaller video dimension such as 960x540, the re-encode speed was around > 85-90FPS. Do you know what x265 quality setting you used? I'm also experimenting now it seems HLSHD is being turned off (series 2 of Salamander has HVF only so far).. RF17 seems to be spitting about half the bitrate of the BBC h.264 output, and running at ~40fps which I can live with (Core i5-6500). Noticeable quality difference still when looking at stills, but have tried watching it moving yet.. Incidentally, has anyone else noticed HE-AAC coming through in the downloads recently? S. ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
On 16/04/2018 2:18 AM, RS wrote: > A couple of years ago there were problems with HLS and there was > speculation that we might have 50 fps HVFhd and DVFhd as the only HD > modes. At that time I wondered if it would be feasible to drop every > other frame to reduce the frame rte to 25 fps. I thought because of > the H.264 delta encoding it would probably mean transcoding and that > it would be too slow. > > On a 42" screen for the programmes that I usually watch I cannot see > any difference between a HD picture at 50 fps and one at 25 fps, so 50 > fps for me is just a waste of bandwidth and storage space, so I have > been looking at it again. I experimented a while ago with running some GiP downloads through Handbrake to convert the video to the x265 codec. That reduced the file size to about 1/3 of the original download, with no subjective difference in video quality that I could see when viewing on our TV. A one hour 1280x720 25fps program that downloads as a 1Gb file was reduced in size to ~350Mb. On my PC, the re-encode runs at about 50fps for 1280x720, so ~2x real time for 25fps and ~real time for 50fps. For smaller video dimension such as 960x540, the re-encode speed was around 85-90FPS. Nick ___ get_iplayer mailing list get_iplayer@lists.infradead.org http://lists.infradead.org/mailman/listinfo/get_iplayer
Re: Using ffmpeg to halve frame rate
I actually worked on this on Friday. I do a lot of work with ffmpeg to get encodes working nicely with my 4K telly along with putting things in iTunes for the AppleTVs. I added a new option for my copy of get_iplayer, akfps, that changes the ffmpeg resolutions should a 50fps version be downloaded. # Recording akfps => [ 1, "akfps!", 'Recording', '--akfps', "AK: Turn on ffmpeg override for 50fps to 25fps conversion"], Down in sub postproc, I modified the section where @codec_opts builds the video/audio codec options. I looked at a few BBC encodes and it seems like they use a bitrate around 2285 with a maxrate of 3500 for hls streams: Bit rate mode: Variable Bit rate : 2 335 kb/s Maximum bit rate : 3 500 kb/s Width: 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 FPS Therefore, I used a target bitrate of 2285 with a maximum of 3500. if ( ! $opt->{ffmpegobsolete} ) { if ( $opt->{akfps} && $prog->{mode} =~ /(hvfhd|dvfhd|hvfsd|dvfsd|hvfhigh|dvfhigh)/ ) { push @codec_opts, ( '-r', '25', '-b:v', '2285k', '-maxrate', '3.5M', '-c:a', 'copy' ); } else { push @codec_opts, ( '-c:v', 'copy', '-c:a', 'copy' ); } } else { if ( $opt->{akfps} && $prog->{mode} =~ /(hvfhd|dvfhd|hvfsd|dvfsd|hvfhigh|dvfhigh)/ ) { push @codec_opts, ( '-r', '25', '-b:v', '2285k', '-maxrate', '3.5M', '-acodec', 'copy' ); } else { push @codec_opts, ( '-vcodec', 'copy', '-acodec', 'copy' ); } } This re-encodes the video, so be warned it increases the amount of time to process downloads. On the system I use the encode gets around 70fps so a 60 minute programme takes around 25 minutes to re-encode. I modified the code this way so that the final tagging process is unaffected. In addition, it only executes on 50fps streams and I took dinky's advice in the squarepenguin forum to set the stream options to get hls if available and fall-back to hvf. On 15 April 2018 at 09:43, Anthony Kehoe wrote: > I actually worked on this on Friday. I do a lot of work with ffmpeg to get > encodes working nicely with my 4K telly along with putting things in iTunes > for the AppleTVs. > > I added a new option for my copy of get_iplayer, akfps, that changes the > ffmpeg resolutions should a 50fps version be downloaded. > > # Recording > akfps => [ 1, "akfps!", 'Recording', '--akfps', "AK: Turn > on ffmpeg override for 50fps to 25fps conversion"], > > Down in sub postproc, I modified the section where @codec_opts builds the > video/audio codec options. I looked at a few BBC encodes and it seems like > they use a bitrate around 2285 with a maxrate of 3500 for hls streams: > > Bit rate mode: Variable > Bit rate : 2 335 kb/s > Maximum bit rate : 3 500 kb/s > Width: 1 280 pixels > Height : 720 pixels > Display aspect ratio : 16:9 > Frame rate mode : Constant > Frame rate : 25.000 FPS > > Therefore, I used a target bitrate of 2285 with a maximum of 3500. > > if ( ! $opt->{ffmpegobsolete} ) { > if ( $opt->{akfps} && $prog->{mode} =~ > /(hvfhd|dvfhd|hvfsd|dvfsd|hvfhigh|dvfhigh)/ ) { > push @codec_opts, ( '-r', '25', '-b:v', '2285k', > '-maxrate', '3.5M', '-c:a', 'copy' ); > } else { > push @codec_opts, ( '-c:v', 'copy', '-c:a', 'copy' > ); > } > } else { > if ( $opt->{akfps} && $prog->{mode} =~ > /(hvfhd|dvfhd|hvfsd|dvfsd|hvfhigh|dvfhigh)/ ) { > push @codec_opts, ( '-r', '25', '-b:v', '2285k', > '-maxrate', '3.5M', '-acodec', 'copy' ); > } else { > push @codec_opts, ( '-vcodec', 'copy', '-acodec', > 'copy' ); > } > } > > This re-encodes the video, so be warned it increases the amount of time to > process downloads. On the system I use the encode gets around 70fps so a 60 > minute programme takes around 25 minutes to re-encode. I modified the code > this way so that the final tagging process is unaffected. In addition, it > only executes on 50fps streams and I took dinky's advice in the > squarepenguin forum to set the stream options to get hls if available and > fall-back to hvf. > > On 15 April 2018 at 09:18, RS wrote: >> >> A couple of years ago there were problems with HLS and there was