how to demux + decode with option -re with file input ffmpeg API's

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to demux + decode with option -re with file input ffmpeg API's

straw
Hi Experts,

I am using NVIDIA SDK decoder which has ffmpeg demuxer which takes both file
and udp input .
But for file input it is decoding{nvdec decoding } more then  real time . i
want to make demuxing and decoding to 1x not more the that .

Like in below example , *how to use -re option in ffmpg API code .
*
 ffmpeg.exe -v debug* -re *-i U4K_jurassic_world_fallen_kingdom_23M.ts -c
copy out.ts


API code snap:
I tried AVDictionary but no luck.

avformat_open_input(&ctx, (const char*)file.ts, NULL, NULL)..

file :
post.c <http://www.ffmpeg-archive.org/file/t378831/post.c>  

I have attached the file for more details .

Kindly help me out . its troubling me and quite urgent ,.

Thanks in advance .






--
Sent from: http://www.ffmpeg-archive.org/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: how to demux + decode with option -re with file input ffmpeg API's

Moritz Barsnick
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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: how to demux + decode with option -re with file input ffmpeg API's

straw
thanks moritz ... For pointing me in right direction .. Yeah i will post in
libav-user.

static int get_input_packet(InputFile *f, AVPacket *pkt){
    if (f->rate_emu) {
        int i;
        for (i = 0; i < f->nb_streams; i++) {
            InputStream *ist = input_streams[f->ist_index + i];
            int64_t pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
            int64_t now = av_gettime_relative() - ist->start;
            if (pts > now)
                return AVERROR(EAGAIN);
        }
    }
#if HAVE_PTHREADS
    if (nb_input_files > 1)
        return get_input_packet_mt(f, pkt);#endif
    return av_read_frame(f->ctx, pkt);}


On Fri, 7 Dec 2018, 22:05 Moritz Barsnick <[hidden email] wrote:

> 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
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".