Ticket #1801 (closed defect: fixed)
muxing.c example code fails for most formats
| Reported by: | AztecC | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | documentation |
| Version: | git-master | Keywords: | |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
Summary of the bug: The muxing.c example in doc/examples only seems to work for a few formats like .avi. Some formats seem to work like .flv, but it produces way too many frames. Anything involving H264 generates a pts(0) < dts(0) error. The fix is fairly simple. Add:
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q( pkt.pts, c->time_base, st->time_base );
if (pkt.dts != AV_NOPTS_VALUE)
pkt.dts = av_rescale_q( pkt.dts, c->time_base, st->time_base );
after the call to avcodec_encode_video2 inside the test for 'got_output'. It can also be added after the call to avcodec_encode_audio2 as well for completeness.
Change History
Note: See
TracTickets for help on using
tickets.



Please send patches to ffmpeg-devel, they typically receive much more attention there.