[FFmpeg-devel] Proposition for new parameter (re delay)

contact at weezo.net contact
Sat Mar 20 16:37:24 CET 2010


Hi All

I've added an extra parameter to ffmpeg command line for personal use, 
and I wonder if it could interest the community to actually integrate it 
into ffmpeg:

This parameter (called -redelay, but this can be changed according to 
ffmpeg standards) gives a time (seconds) before -re parameter is applied.

What for?

I use ffmpeg for real-time video encoding and streaming (weezo.net 
software), so -re option is used to encode video at native rate (no 
useless bandwidth & CPU).

But clients (flash player and iPhone player) buffer a certain amount of 
video before starting to play.

With -re option, buffering process will be longer as video is encoded 
slowly, so video will start playing with a noticeably longer delay.
This is of course true only if bandwidth is sufficient.


This new command option solves this issue:

For example, calling ffmpeg.exe -re -redelay 5 -i... will encode first 5 
seconds at max CPU speed and then slow down to native frame rate.

Integration in ffmpeg.c is really simple (3 lines):

add:
static uint64_t opt_rate_emu_delay = 0;

modify: if(pts > now)  usleep(pts - now); into:
if(pts > now + opt_rate_emu_delay*1000000)  usleep(pts - now - 
opt_rate_emu_delay*1000000);

add:
{ "redelay", HAS_ARG | OPT_INT64, {(void*)&opt_rate_emu_delay}, "set 
time (sec) before slowing down to native frame rate", "time" },


So if anyone is interested, let me know!
But I'll let you apply those changes to ffmpeg, I don't want to mess 
with that SVN stuff (err I actually don't really know how it works).

Nicolas



More information about the ffmpeg-devel mailing list