Ticket #1242 (closed defect: fixed)

Opened 13 months ago

Last modified 10 months ago

Remuxing Matroska to MPEG transport stream with -copyts errors out with non monotonically increasing dts

Reported by: chucks Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: av_interleaved_write_frame mkv copyts
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I am using  http://serviio.org/ as a media server to a media device not supporting Matroska container formats, ffmpeg errors out with "Application provided invalid, non monotonically increasing dts to muxer in stream ...".

After testing differences between the frozen source version that the Serviio project distributes, there appears to be a regression between the working ffmpeg version 0.9 distributed by Serviio as a source tarball built on x86_64, the non-working ffmpeg versions 0.9.1-54 and 0.10.2-54 distributed by  http://atrpms.net/ as Fedora 16 x86_64 RPMs, and the git sources from  git://source.ffmpeg.org/ffmpeg.git as of commit b21ba20cc83c80fe56192fee3626a8087f37d806 on Sun Apr 22 03:47:53 2012 +0200.

Past experience has shown that omitting the -copyts may cause Matroska remuxed to MPEGts without -copyts may cause video and audio losing synchronization when rendering the resulting files on the client devices.

Attached are ffmpeg report logs and sample media file.

Attachments

sample.mkv Download (2.1 MB) - added by chucks 13 months ago.
sample Matroska track with h.264 video, AAC audio
ffmpeg-20120422-161053.log Download (3.2 KB) - added by chucks 13 months ago.
Command line similar to what is captured from serviio
ffmpeg-20120422-161104.log Download (2.9 KB) - added by chucks 13 months ago.
Command line where audio is simply remuxed, not transcoded.
ffmpeg-20120422-161113.log Download (16.1 KB) - added by chucks 13 months ago.
Command line where audio is simply remuxed, not transcoded without -copyts

Change History

comment:1 Changed 13 months ago by cehoyos

Please provide a minimal command line together with complete, uncut console output and a sample.

Since you mention a reason why you have to use -copyts: Did you report this problem?

comment:2 follow-up: ↓ 5 Changed 13 months ago by chucks

Logs and sample media file provided. The choice to include -copyts was from the serviio team due to captures CLI output with /bin/ps. Previous experience with transcoding has shown that omitting the -copyts may result in files without properly synchronized audio and video streams. Research into this issue appears to show that the Matroska format doesn't appear to store timestamps as often as other formats, but that is the limit of my understanding of media formats.

Last edited 13 months ago by chucks (previous) (diff)

Changed 13 months ago by chucks

sample Matroska track with h.264 video, AAC audio

Changed 13 months ago by chucks

Command line similar to what is captured from serviio

Changed 13 months ago by chucks

Command line where audio is simply remuxed, not transcoded.

Changed 13 months ago by chucks

Command line where audio is simply remuxed, not transcoded without -copyts

comment:3 Changed 12 months ago by patters

Just thought I'd mention that the Serviio-distributed version of FFmpeg includes a patch specifically to fix this issue, which I believe has still never been in any release version of FFmpeg. So it's not a 'clean' version of 0.9, and therefore what you describe is not a regression as such.

I can't find the thread now, but this question comes up on the Serviio forum and I seem to recall that Zip (Serviio's developer) mentioned something of how this fix is considered by the FFmpeg developers as a somewhat dirty workaround, which is why it isn't committed.

Last edited 12 months ago by patters (previous) (diff)

comment:4 Changed 12 months ago by cehoyos

  • Keywords av_interleaved_write_frame mkv added; matroska mpegts non-monotonic dts removed

I don't think there is a problem, after all, FFmpeg by default copies the video stream fine, but I may of course be wrong.

comment:5 in reply to: ↑ 2 Changed 12 months ago by cehoyos

Replying to chucks:

Previous experience with transcoding has shown that omitting the -copyts may result in files without properly synchronized audio and video streams.

Sounds like an important bug, did you report this?

comment:6 Changed 12 months ago by chucks

I'll see what I can do to locate the offending file that was exhibiting the audio/video stream sync issues when remuxing to file a separate report concerning the issue, but spare time is a precious commodity I have little spare of at the present.

comment:7 Changed 10 months ago by michael

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