Using ffmpeg to halve frame rate

RS richard22j at zoho.com
Sun Apr 15 09:18:08 PDT 2018


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.

The ffmpeg documentation
https://www.ffmpeg.org/ffmpeg.html#toc-Video-Options

at 5.5 Video Options says for -r
"As an output option, duplicate or drop input frames to achieve constant 
output frame rate fps."

That would be very useful if it means there is no need for transcoding.

I found this example.
https://stackoverflow.com/questions/45462731/using-ffmpeg-to-change-framerate?rq=1

The command I used for the first suggestion, with re-encoding, was

ffmpeg -i am.mp4 -vf "setpts=PTS" -f 25 am4.mp4

That worked and kept the audio.  It was slow, taking about 1.5 times 
real time.  Also the bit rate at about 1.4Mbit/s was only about 
two-thirds of what I was expecting, so it may have been more compressed 
than the original.  I had first tried "setpts=0.5*PTS" but that produced 
a file which played at twice speed and "setpts=2*PTS" which played at 
half speed.

For the second example without re-encoding my commands were

ffmpeg -i am.mp4 -c copy -f h264 am1.h264
ffmpeg -i am1.h264 -c copy -r 25 am2.mp4

There was no audio, although that can be added back later.  It was quite 
quick, at about a fiftieth of real time.  It did not achieve any 
reduction in file size or bit rate. and the frame rate remained at 50 
fps, so the -r 25 had been ignored.  I did get lots of error messages 
saying "pts has no value" so maybe I need to set that.  I did try 
repeating the -vf parameter from the first command it said,

Filtergraph 'setpts=PTS' was defined for video output stream 0:0 but 
codec copy was selected.
Filtering and streamcopy cannot be used together.

The second example from the stackoverflow page placed the parameter 
-r=25 before -i.  I tried that.  There was no reduction in file size but 
the time was made twice as long and the file played at half speed.  As I 
understand it, placing the parameter in that position made it an input 
option.

Has anyone managed to get ffmpeg to halve the frame rate without 
re-encoding?  Can it be applied to the raw .ts output?

Best wishes
Richard




More information about the get_iplayer mailing list