[Libav-user] timebase settings when muxing

YIRAN LI mrfun.china at gmail.com
Wed Nov 16 08:37:44 EET 2016

Hi, I'm using ffmpeg to mux to ASF format, but the generated file has a
little problem.

https://dl.dropboxusercontent.com/u/89678527/big_buck_bunny.wmv This video
when used with ffprobe -show_frames -select_streams v, it can show correct
number of frames(about 23.97 * 60 = 1440 frames), but when I use ffmpeg -i
name %06d.jpg it can dump out about 40,000 frames. So when played by
ffplay, video playback is very slow.

I guess it's somewhat related to timebase. Run ffprobe on this file I can

  *Duration: 00:01:00.02, start: 0.000000, bitrate: 2278 kb/s*
*    Stream #0:0: Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 640x360,
1k tbr, 1k tbn, 1k tbc*

As I said I use ffmpeg to mux (video/audio are encoded with 3rd party
encoders). To mux, basically what I do is:
1. pOutputFormat = guess_format("asf", NULL, NULL);
2. pFormatCtx = av_alloc_format_context(); pFormatCtx->format =
3. set video encoder
4. Create video stream: pVideoStream = av_new_stream(pFormatCtx, 0);
5. set code_id, code_type, timebase on pVideoCodecCtx = pVideoStream->codec;
6. set audio encoder, create audio stream, set settings on
7. call av_write_header
8. call av_interleaved_write_frame to write data
9. call av_write_trailer

The only place I set timebase is set pVideoCodecCtx->time_base, do I need
to set time base on videostream or formactx?

Thanks for help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20161116/679611c6/attachment.html>

More information about the Libav-user mailing list