Opened 5 years ago

Closed 5 years ago

#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 (2)

comment:1 Changed 5 years ago by cehoyos

  • Component changed from undetermined to documentation
  • Keywords muxing.c pts dts removed
  • Version changed from unspecified to git-master

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

comment:2 Changed 5 years ago by michael

  • Reproduced by developer set
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.