[Libav-user] time_scale issue with 3.1 ABI
Charles
linux2 at orion15.org
Thu Aug 25 01:08:11 EEST 2016
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;
More information about the Libav-user
mailing list