Opened 12 years ago

Closed 12 years ago

#1801 closed defect (fixed)

muxing.c example code fails for most formats

Reported by: JIm Goodnow II 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 (2)

comment:1 by Carl Eugen Hoyos, 12 years ago

Component: undetermineddocumentation
Keywords: muxing.c pts dts removed
Version: unspecifiedgit-master

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

comment:2 by Michael Niedermayer, 12 years ago

Reproduced by developer: set
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.