FAQ  •  Register  •  Login

MKV split with mkvmerge won't transcode

<<

mjb

User avatar

Streaming enthusiast

Posts: 45

Joined: Fri Jan 06, 2012 10:42 pm

Post Sun Nov 11, 2012 1:39 pm

MKV split with mkvmerge won't transcode

I have a playable MKV that I created with mkvmerge 5.7.0. If I then use mkvmerge on this file to split it into pieces, the resulting files won't play; my Samsung BD player (C series) says "Not supported file format" right away, and serviio.log says "FFmpeg execution failed at org.serviio.delivery.resource.transcode.FileBasedTranscodingDeliveryStrategy.createInputStream(FileBasedTranscodingDeliveryStrategy.java:47)"

MediaInfo tells me the only notable difference is that the original, playable MKV contains this info, which is not in the new, unplayable file:
Format settings, GOP : M=8, N=24

Here's an example of how I did the split (extracting a 7-minute segment to a separate file):
mkvmerge --split parts:30:17.08-37:58.2 -o "output.mkv" "input.mkv"
Like I said, input.mkv plays fine. output.mkv does not.

I used mkvmerge because ffmpeg has trouble demuxing MKVs. For example, if I try to do the split with ffmpeg...
ffmpeg -ss 00:30:17.08 -i "input.mkv" -t 00:07:41.12 -vcodec copy -acodec copy "output.mkv"
...then I get this:

  Code:
Input #0, matroska,webm, from 'input.mkv':
  Metadata:
    creation_time   : 2012-11-10 19:18:27
  Duration: 01:41:30.20, start: 0.000000, bitrate: 8779 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0:1(ita): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
Output #0, matroska, to 'output.mkv':
  Metadata:
    encoder         : Lavf54.36.100
    Stream #0:0: Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn, 1k tbc
    Stream #0:1(ita): Audio: ac3, 48000 Hz, stereo, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0000000005a575a0] pts (-880) < dts (-800) in stream 0
av_interleaved_write_frame(): Invalid argument


Here's the ffmpeg -i for the original file:

  Code:
ffmpeg version N-46469-gc995644 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov  5 2012 17:58:15 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  5.100 / 52.  5.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 21.106 /  3. 21.106
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  1.100 / 52.  1.100
Input #0, matroska,webm, from 'input.mkv':
  Metadata:
    creation_time   : 2012-11-10 19:18:27
  Duration: 01:41:30.20, start: 0.000000, bitrate: 8779 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0:1(ita): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s


And here's the ffmpeg -i for the new file (not very helpful):

  Code:
[same config]
Input #0, matroska,webm, from 'output.mkv':
  Metadata:
    creation_time   : 2012-11-11 06:28:30
  Duration: 00:07:41.56, start: 0.000000, bitrate: 9845 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0:1(ita): Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s


Also, I tried removing the following line from profiles.xml:
<Matches container="matroska" mkvHeaderCompressed="true" />
When I do that, no transcoding is attempted, but then none of the MKVs will play, not even the original. I get "Not supported file format" after a long pause. So I leave this line in.

Is this a problem that Serviio can work around, or do I need to take it up with the mkvmerge developers, or am I doing something wrong...?

Thanks for taking a look, and let me know if you need more info.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17215

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Nov 11, 2012 10:28 pm

Re: MKV split with mkvmerge won't transcode

The produced file has got invalid timestamps, that's why FFmpeg fails. Probably problem of MkvMerge. The original might have compressed headers, which the TV doesn't like. You should be able to remove them with MkvMerge. There is a tutorial on the wiki I think.
<<

mjb

User avatar

Streaming enthusiast

Posts: 45

Joined: Fri Jan 06, 2012 10:42 pm

Post Mon Nov 12, 2012 2:28 am

Re: MKV split with mkvmerge won't transcode

You rock. I searched the wiki and found the article you're talking about:

http://wiki.serviio.org/doku.php?id=header_com

I produced a new file like this:

mkvmerge --split parts:30:17.08-37:58.2 --compression 0:none --compression 1:none --clusters-in-meta-seek -o "output.mkv" "input.mkv"

It worked perfectly; output.mkv plays and is not transcoded.
I also improved the wiki article for clarity and to add command-line instructions.
Thanks!!

As for the bad timestamps preventing transcoding, I will ask at bunkus.org.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17215

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Nov 12, 2012 5:40 pm

Re: MKV split with mkvmerge won't transcode

mjb wrote:I also improved the wiki article for clarity and to add command-line instructions.

Thanks :)

Return to Transcoding

Who is online

Users browsing this forum: No registered users and 40 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.