[FFmpeg-user] Preserving subtitles when transcoding mkv to wmv (or avi)?

Markus Fischer markus at fischer.name
Wed Dec 28 01:04:09 CET 2011


Hi,

when I transcode a mkv to avi, I cannot seem to retain the subtitles.

Example:

$ ffmpeg.exe -i sample.mkv -an -scodec copy -y test.wmv
ffmpeg version N-36193-gf514695, Copyright (c) 2000-2011 the FFmpeg
developers
  built on Dec 26 2011 17:55:53 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-runtime-cpudetect --enable-avisynth --enable-bzlib
--enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libfreetype --enable-libgsm --enable-libmp3lame
--enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 48.100 / 53. 48.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 54.100 /  2. 54.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100
Input #0, matroska,webm, from 'sample.mkv':
  Duration: 02:13:14.99, start: 0.000000, bitrate: 5857 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x696 [SAR 1:1 DAR
160:87], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536
kb/s (default)
    Stream #0:2(eng): Subtitle: text (default)
[buffer @ 0000000003C97DA0] w:1280 h:696 pixfmt:yuv420p tb:1/1000000
sar:1/1 sws_param:
Output #0, asf, to 'test.wmv':
  Metadata:
    WM/EncodingSettings: Lavf53.28.100
    Stream #0:0(eng): Video: msmpeg4 (MP43 / 0x3334504D), yuv420p,
1280x696 [SAR 1:1 DAR 160:87], q=2-31, 200 kb/s, 1k tbn, 23.98 tbc (default)
    Stream #0:1(eng): Subtitle: text (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> msmpeg4)
  Stream #0:2 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?)

Leaving out "-scodec copy" successfully transcodes the file.

Is this a problem with ffmpeg? or with the WMV container format?

I think AVI would also be an option, but in this case I get a clear
message that a special format is required for the subtitles:

ffmpeg.exe -i sample.mkv -an -scodec copy -y test.avi
ffmpeg version N-36193-gf514695, Copyright (c) 2000-2011 the FFmpeg
developers
  built on Dec 26 2011 17:55:53 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-runtime-cpudetect --enable-avisynth --enable-bzlib
--enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libfreetype --enable-libgsm --enable-libmp3lame
--enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 48.100 / 53. 48.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 54.100 /  2. 54.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100
Input #0, matroska,webm, from 'sample.mkv':
  Duration: 02:13:14.99, start: 0.000000, bitrate: 5857 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x696 [SAR 1:1 DAR
160:87], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536
kb/s (default)
    Stream #0:2(eng): Subtitle: text (default)
[buffer @ 0000000003E17DA0] w:1280 h:696 pixfmt:yuv420p tb:1/1000000
sar:1/1 sws_param:
[avi @ 0000000003DCDF80] Subtitle streams other than DivX XSUB are not
supported by the AVI muxer.
Output #0, avi, to 'test.avi':
  Metadata:
    encoder         : Lavf53.28.100
    Stream #0:0(eng): Video: mpeg4 (FMP4 / 0x34504D46), yuv420p,
1280x696 [SAR 1:1 DAR 160:87], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
(default)
    Stream #0:1(eng): Subtitle: text (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:2 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?)

The important line is:
[avi @ 0000000003DCDF80] Subtitle streams other than DivX XSUB are not
supported by the AVI muxer.


All I'm trying is get videos playing on my XBOX 360 properly supporting
subtitles.

thanks,
- Markus


More information about the ffmpeg-user mailing list