[Libav-user] How to get AVCodec timebase ?

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

[Libav-user] How to get AVCodec timebase ?

Ivan Kuchin
Hello experts, 

   I'm building transcoder and sometimes avcodec_open2 returns decoder.time_base = {0, 1} for src video, although "ffmpeg -i xxx" and "ffprobe -show_stream " returns correct tbc and codec_time_base.

   Problem: in some cases codec_time_base != (AVRational) {1, framerate} (in my case codec_time_base=1/60, but framerate=30). 

   I'm aware about example transcode.c and I tested it and it is not working too. 

   Question: how can I get correct codec_time_base in API ? 

JFYI: Ubuntu + 7:3.3.1-1~16.04.york0

Thanks a lot 

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: How to get AVCodec timebase ?

Ivan Kuchin
Pardon me, I hit send-button too fast, w/o double check. 

Actually I got wrong value, here is what I'm doing:
----------------------------------
avformat_open_input
avformat_find_stream_info
loop_through_all_streams:
if(video)
{
avcodec_find_decoder
avcodec_alloc_context3
avcodec_parameters_to_context
avcodec_open2 <------------ after that time_base = {0,2}
}
av_dump_format (missing tbc)
Stream #0:0(und), 2, 1/30000: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 960x540, 0/1, 2142 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
------------------------------------

ffprobe -show_streams  (shows 59.94)
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x540, 2142 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
and
codec_time_base=1001/60000

How can I get correct value 1001/60000 ?


On Sat, May 27, 2017 at 11:07 PM, Ivan Kuchin <[hidden email]> wrote:
Hello experts, 

   I'm building transcoder and sometimes avcodec_open2 returns decoder.time_base = {0, 1} for src video, although "ffmpeg -i xxx" and "ffprobe -show_stream " returns correct tbc and codec_time_base.

   Problem: in some cases codec_time_base != (AVRational) {1, framerate} (in my case codec_time_base=1/60, but framerate=30). 

   I'm aware about example transcode.c and I tested it and it is not working too. 

   Question: how can I get correct codec_time_base in API ? 

JFYI: Ubuntu + 7:3.3.1-1~16.04.york0

Thanks a lot 


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user