[FFmpeg-user] how to demux + decode with option -re with file input ffmpeg API's

Moritz Barsnick barsnick at gmx.net
Fri Dec 7 18:35:00 EET 2018


On Fri, Dec 07, 2018 at 06:31:14 -0600, straw wrote:
> Like in below example , *how to use -re option in ffmpg API code .

For questions regarding the use of the ffmpeg API, please consult the
libav-user mailing list:
https://ffmpeg.org/mailman/listinfo/libav-user

> I tried AVDictionary but no luck.
> avformat_open_input(&ctx, (const char*)file.ts, NULL, NULL)..

The "-re" option is a feature of the ffmpeg command line client. I
don't believe it is directly available in the API. OTOH, the filters
"realtime" and "arealtime" emulate this behavior (but not if you're
doing stream copy, obviously).

You may need to implement the same behavior in your program. Check this
code segment here:

https://github.com/FFmpeg/FFmpeg/blob/05a61a02d628a04fa8a672ef062adf4de2ed7df6/fftools/ffmpeg.c#L3685

and here:

https://github.com/FFmpeg/FFmpeg/blob/05a61a02d628a04fa8a672ef062adf4de2ed7df6/fftools/ffmpeg.c#L4132

The variable triggered by "re" is "rate_emu".

Cheers,
Moritz


More information about the ffmpeg-user mailing list