Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques Changing containers from mp4 to mkv, with subtitles (created with Handbrake)

  • Changing containers from mp4 to mkv, with subtitles (created with Handbrake)

    Posted by Felipe Garcia on March 20, 2012 at 10:42 am

    I am trying to move a mp4 file that has subtitles created with Handbrake to a mkv container employing ffmpeg and I get an error. I know it is related to the subtitles and to the fact of changing container, because I had no problems re-encoding the audio in the same container and keeping subtitles and video unchanged and I also had no problems when I excluded the subtitles and changed container from mp4 to mkv.

    I tried both to copy the subtitle unchanged and to re-encode it and none work. Here are the commands and the error messages:

    ffmpeg -i SpringLecture2011.mp4 -map 0 -c copy SpringLecture2011.mkv
    Could not write header for output file #0 (incorrect codec parameters ?)

    ffmpeg -i SpringLecture2011.mp4 -map 0 -c:v copy -c:a copy -codec:s srt SpringLecture2011.mkv
    Data stream encoding not supported yet (only streamcopy)

    Any idea of what could be the cause of this error and the way to solve it?

    Thanks in advance!

    Here is the whole output of both commands:

    $ ffmpeg -i SpringLecture2011.mp4 -map 0 -c copy SpringLecture2011.mkv
    ffmpeg version N-38847-g219a6fb Copyright (c) 2000-2012 the FFmpeg developers
    built on Mar 17 2012 22:37:47 with gcc 4.6.3
    configuration: –prefix=/usr/local –enable-gpl –enable-version3 –enable-nonfree –enable-x11grab –enable-small –enable-libaacplus –enable-libass –enable-libdirac –enable-libfaac –enable-libfreetype –enable-libmp3lame –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-libvpx –enable-libx264 –enable-postproc –enable-pthreads –enable-libopencore-amrnb –enable-libvo-amrwbenc
    libavutil 51. 42.100 / 51. 42.100
    libavcodec 54. 10.100 / 54. 10.100
    libavformat 54. 2.100 / 54. 2.100
    libavdevice 53. 4.100 / 53. 4.100
    libavfilter 2. 65.100 / 2. 65.100
    libswscale 2. 1.100 / 2. 1.100
    libswresample 0. 7.100 / 0. 7.100
    libpostproc 52. 0.100 / 52. 0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘SpringLecture2011.mp4’:
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    creation_time : 2012-03-12 21:46:15
    encoder : Lavf54.2.100
    Duration: 01:22:24.54, start: 0.000000, bitrate: 235 kb/s
    Chapter #0.0: start 0.000000, end 344.844500
    Metadata:
    title : Chapter 1
    Chapter #0.1: start 344.844500, end 1058.657600
    Metadata:
    title : Chapter 2
    Chapter #0.2: start 1058.657600, end 1501.099600
    Metadata:
    title : Chapter 3
    Chapter #0.3: start 1501.099600, end 1861.459600
    Metadata:
    title : Chapter 4
    Chapter #0.4: start 1861.459600, end 2375.973600
    Metadata:
    title : Chapter 5
    Chapter #0.5: start 2375.973600, end 2726.323600
    Metadata:
    title : Chapter 6
    Chapter #0.6: start 2726.323600, end 3261.057800
    Metadata:
    title : Chapter 7
    Chapter #0.7: start 3261.057800, end 3704.300600
    Metadata:
    title : Chapter 8
    Chapter #0.8: start 3704.300600, end 3827.924100
    Metadata:
    title : Chapter 9
    Chapter #0.9: start 3827.924100, end 4148.744600
    Metadata:
    title : Chapter 10
    Chapter #0.10: start 4148.744600, end 4340.936600
    Metadata:
    title : Chapter 11
    Chapter #0.11: start 4340.936600, end 4944.540000
    Metadata:
    title : Chapter 12
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 712×480 [SAR 8:9 DAR 178:135], 124 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), s16, 32 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:2(fra): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), s16, 31 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:3(spa): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), s16, 31 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:4(eng): Data: unknown_codec ([224][0][0][0] / 0x00E0)
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SubtitleHandler
    Stream #0:5(und): Subtitle: unknown_codec (tx3g / 0x67337874)
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name :
    [matroska @ 0xadfadc0] Only audio, video, and subtitles are supported for Matroska.
    [matroska @ 0xadfadc0] Subtitle codec 94213 is not supported.
    Output #0, matroska, to ‘SpringLecture2011.mkv’:
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    creation_time : 2012-03-12 21:46:15
    encoder : Lavf54.2.100
    Chapter #0.0: start 0.000000, end 344.844500
    Metadata:
    title : Chapter 1
    Chapter #0.1: start 344.844500, end 1058.657600
    Metadata:
    title : Chapter 2
    Chapter #0.2: start 1058.657600, end 1501.099600
    Metadata:
    title : Chapter 3
    Chapter #0.3: start 1501.099600, end 1861.459600
    Metadata:
    title : Chapter 4
    Chapter #0.4: start 1861.459600, end 2375.973600
    Metadata:
    title : Chapter 5
    Chapter #0.5: start 2375.973600, end 2726.323600
    Metadata:
    title : Chapter 6
    Chapter #0.6: start 2726.323600, end 3261.057800
    Metadata:
    title : Chapter 7
    Chapter #0.7: start 3261.057800, end 3704.300600
    Metadata:
    title : Chapter 8
    Chapter #0.8: start 3704.300600, end 3827.924100
    Metadata:
    title : Chapter 9
    Chapter #0.9: start 3827.924100, end 4148.744600
    Metadata:
    title : Chapter 10
    Chapter #0.10: start 4148.744600, end 4340.936600
    Metadata:
    title : Chapter 11
    Chapter #0.11: start 4340.936600, end 4944.540000
    Metadata:
    title : Chapter 12
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 712×480 [SAR 8:9 DAR 178:135], q=2-31, 124 kb/s, 29.97 fps, 1k tbn, 90k tbc
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), 32 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:2(fra): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), 31 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:3(spa): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), 31 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:4(eng): Data: unknown_codec ([224][0][0][0] / 0x00E0)
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SubtitleHandler
    Stream #0:5(und): Subtitle: unknown_codec (tx3g / 0x67337874)
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name :
    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Stream #0:1 -> #0:1 (copy)
    Stream #0:2 -> #0:2 (copy)
    Stream #0:3 -> #0:3 (copy)
    Stream #0:4 -> #0:4 (copy)
    Stream #0:5 -> #0:5 (copy)
    Could not write header for output file #0 (incorrect codec parameters ?)

    ffmpeg -i SpringLecture2011.mp4 -map 0 -c:v copy -c:a copy -codec:s srt SpringLecture2011.mkv
    ffmpeg version N-38847-g219a6fb Copyright (c) 2000-2012 the FFmpeg developers
    built on Mar 17 2012 22:37:47 with gcc 4.6.3
    configuration: –prefix=/usr/local –enable-gpl –enable-version3 –enable-nonfree –enable-x11grab –enable-small –enable-libaacplus –enable-libass –enable-libdirac –enable-libfaac –enable-libfreetype –enable-libmp3lame –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-libvpx –enable-libx264 –enable-postproc –enable-pthreads –enable-libopencore-amrnb –enable-libvo-amrwbenc
    libavutil 51. 42.100 / 51. 42.100
    libavcodec 54. 10.100 / 54. 10.100
    libavformat 54. 2.100 / 54. 2.100
    libavdevice 53. 4.100 / 53. 4.100
    libavfilter 2. 65.100 / 2. 65.100
    libswscale 2. 1.100 / 2. 1.100
    libswresample 0. 7.100 / 0. 7.100
    libpostproc 52. 0.100 / 52. 0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘SpringLecture2011.mp4’:
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    creation_time : 2012-03-12 21:46:15
    encoder : Lavf54.2.100
    Duration: 01:22:24.54, start: 0.000000, bitrate: 235 kb/s
    Chapter #0.0: start 0.000000, end 344.844500
    Metadata:
    title : Chapter 1
    Chapter #0.1: start 344.844500, end 1058.657600
    Metadata:
    title : Chapter 2
    Chapter #0.2: start 1058.657600, end 1501.099600
    Metadata:
    title : Chapter 3
    Chapter #0.3: start 1501.099600, end 1861.459600
    Metadata:
    title : Chapter 4
    Chapter #0.4: start 1861.459600, end 2375.973600
    Metadata:
    title : Chapter 5
    Chapter #0.5: start 2375.973600, end 2726.323600
    Metadata:
    title : Chapter 6
    Chapter #0.6: start 2726.323600, end 3261.057800
    Metadata:
    title : Chapter 7
    Chapter #0.7: start 3261.057800, end 3704.300600
    Metadata:
    title : Chapter 8
    Chapter #0.8: start 3704.300600, end 3827.924100
    Metadata:
    title : Chapter 9
    Chapter #0.9: start 3827.924100, end 4148.744600
    Metadata:
    title : Chapter 10
    Chapter #0.10: start 4148.744600, end 4340.936600
    Metadata:
    title : Chapter 11
    Chapter #0.11: start 4340.936600, end 4944.540000
    Metadata:
    title : Chapter 12
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 712×480 [SAR 8:9 DAR 178:135], 124 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), s16, 32 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:2(fra): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), s16, 31 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:3(spa): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 2 channels (FC), s16, 31 kb/s
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SoundHandler
    Stream #0:4(eng): Data: unknown_codec ([224][0][0][0] / 0x00E0)
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name : SubtitleHandler
    Stream #0:5(und): Subtitle: unknown_codec (tx3g / 0x67337874)
    Metadata:
    creation_time : 2012-03-12 21:46:15
    handler_name :
    Data stream encoding not supported yet (only streamcopy)

    Felipe Garcia replied 14 years, 2 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy