Opened 12 years ago

Closed 12 years ago

#1242 closed defect (fixed)

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 (4)

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

Change History (11)

comment:1 by Carl Eugen Hoyos, 12 years ago

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 by Chucks, 12 years ago

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 12 years ago by Chucks (previous) (diff)

by Chucks, 12 years ago

Attachment: sample.mkv added

sample Matroska track with h.264 video, AAC audio

by Chucks, 12 years ago

Attachment: ffmpeg-20120422-161053.log added

Command line similar to what is captured from serviio

by Chucks, 12 years ago

Attachment: ffmpeg-20120422-161104.log added

Command line where audio is simply remuxed, not transcoded.

by Chucks, 12 years ago

Attachment: ffmpeg-20120422-161113.log added

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

comment:3 by patters, 12 years ago

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 years ago by patters (previous) (diff)

comment:4 by Carl Eugen Hoyos, 12 years ago

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.

in reply to:  2 comment:5 by Carl Eugen Hoyos, 12 years ago

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 by Chucks, 12 years ago

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 by Michael Niedermayer, 12 years ago

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