[Libav-user] time_scale issue with 3.1 ABI

Charles linux2 at orion15.org
Thu Aug 25 05:49:15 EEST 2016


Is this a bug?

ffmpeg -loglevel debug -f x11grab -r 60 -video_size 1024x768 -i :0.3 -vcodec h264_nvenc -pix_fmt yuv420p -preset lossless -profile:v high 
-rc vbr_minqp -gpu 1 test2.mp4ffmpeg version N-81328-gceab04f Copyright (c) 2000-2016 the FFmpeg developers
   built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
   configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 
--mandir=/usr/share/man --extra-cflags=-I../Video_Codec_SDK_7.0.1/Samples/common/inc --pkg-config-flags=--static --arch=x86_64 
--optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 
--enable-bzlib --disable-crystalhd --enable-gnutls --enable-decoder=aac --disable-indev=jack --enable-libfreetype --enable-libgsm 
--enable-libopenjpeg --enable-libpulse --enable-libtheora --enable-libvorbis --enable-avfilter --enable-avresample --enable-postproc 
--enable-pthreads --disable-static --enable-shared --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect --enable-opengl 
--enable-nvenc --enable-vdpau
   libavutil      55. 28.100 / 55. 28.100
   libavcodec     57. 51.102 / 57. 51.102
   libavformat    57. 46.101 / 57. 46.101
   libavdevice    57.  0.102 / 57.  0.102
   libavfilter     6. 51.100 /  6. 51.100
   libavresample   3.  0.  0 /  3.  0.  0
   libswscale      4.  1.100 /  4.  1.100
   libswresample   2.  1.100 /  2.  1.100
[...]
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[...]

Spam on cur_dts is invalid
Output:
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], 522 kb/s, 60 fps, 60 tbr, 
15360 tbn, 120 tbc (default)

Thanks
cco



On 08/24/2016 05:08 PM, Charles wrote:
> Not sure where the problem is but the same code with different containers
> Can't seem to make the container honor the encoders frame_rate
>
> How do you get the time_scale correct in a video only stream?
>
> in transcoding.c it just copies the input pts
> in muxing.c its set fron next_pts for number of audio samples
> in remuxing.c it is set from av_rescale_q_rnd with in stream to out stream
>
> Thanks
> cco
>
> Details:
>
> mp4 header
> Stream #0:0: Video: h264 (h264_nvenc), yuv420p, 1024x768, q=-1--1, 3000 kb/s, 60 tbr, 60 tbn
> mp4 600 frames (ffprobe)
> Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], 3027 kb/s, 60.10 fps, 60 tbr, 15360 tbn, 120
> tbc (default)
>
> mkv header
> Stream #0:0: Video: h264 (h264_nvenc), yuv420p, 1024x768, q=-1--1, 3000 kb/s, 60 tbr, 60 tbn
> mkv 600 frame (ffprobe)
> Stream #0:0: Video: h264 (High), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], 1k fps, 60 tbr, 1k tbn, 120 tbc (default)
>
> From the dumps I can tell that tbn is messed up and from libavformat/dump.c I see it is related to frame_rate
>
> I can play both output in VLC does it has issues...
>
> I create the codec and and context then
>
>    video_st = avformat_new_stream( av_out_fmt_ctx, av_encode_codec );
>    video_st->time_base = AVRational{ 1, fps };
>    av_stream_set_r_frame_rate( video_st, AVRational{ fps, 1 } );
>
>    avcodec_parameters_from_context
>
>    avcodec_open2
>      flags |= CODEC_FLAG_GLOBAL_HEADER
>    av_dump_format( av_out_fmt_ctx, 0, fname.c_str(), 1 );
>    avformat_write_header
>
>
>    dst_frame->pts = frame_count;
>    avcodec_send_frame
>    avcodec_receive_packet
>
> //// This is what I have tried
>       av_packet_rescale_ts( &m_av_packet, m_av_codec_ctx->time_base, m_av_out_fmt_ctx->streams[ 0 ]->time_base );
> ///         m_av_packet.pts = m_av_packet.dts = AV_NOPTS_VALUE;
> ///         m_av_packet.pts++;
>
> ///         m_av_packet.pts = packet_count++;
> ///         m_av_packet.dts = m_av_packet.pts - 1;
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user



More information about the Libav-user mailing list