Ticket #2260 (new defect)

Opened 3 months ago

Last modified 2 months ago

FFmpeg doesn't auto-select subtitle codec for MP4

Reported by: slhck Owned by:
Priority: normal Component: FFmpeg
Version: git-master Keywords: mov
Cc: Blocked By: 1845
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

FFmpeg doesn't seem to be able to auto-select the proper subtitle codec for MP4, which would be mov_text.

I expect FFmpeg to automatically choose the codec, similar to how it does with libx264 and libfaac.

ffmpeg -i in.mp4 -i subs.srt -c:v copy -c:a copy -map 0 -map 1 out.mp4
ffmpeg version 1.1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  8 2013 22:55:29 with Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-01-08 11:16:19
    encoder         : Lavf53.24.0
  Duration: 00:03:31.58, start: 0.000000, bitrate: 2359 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2229 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : SoundHandler
[srt @ 0x7fb8ea843c00] Estimating duration from bitrate, this may be inaccurate
Input #1, srt, from 'subs.srt':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Subtitle: subrip
File 'out.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf53.24.0
    Stream #0:0(eng): Video: h264, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2229 kb/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac, 48000 Hz, stereo, 125 kb/s
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : SoundHandler
    Stream #0:2: Subtitle: none
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #1:0 -> #0:2 (subrip -> ?)
Encoder (codec none) not found for output stream #0:2

Encoding with -c:s mov_text works fine.

Change History

comment:1 Changed 3 months ago by slhck

  • Version changed from 1.1.2 to git-master

Also broken in Git Master (git-2013-02-10-3acaea2)

comment:2 in reply to: ↑ description Changed 3 months ago by cehoyos

  • Keywords mov added; subtitles, mp4 removed

Replying to slhck:

Encoding with -c:s mov_text works fine.

Are you sure? Ticket #1845 indicates it does not work.

comment:3 Changed 3 months ago by slhck

Oh, you're correct. The subtitle file had at the beginning of the video, and playing the file resulted in a black screen in QuickTime? player (and crashed VLC).

Feel free to close this issue then.

(Any workaround for subtitles in MP4?)

comment:4 follow-up: ↓ 5 Changed 2 months ago by llogan

  • Blocked By set to 1845

Instead of closing I'm going to consider this being blocked by #1845.

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6 Changed 2 months ago by cehoyos

Replying to llogan:

Instead of closing I'm going to consider this being blocked by #1845.

I wonder if it isn't actually a bug that FFmpeg auto-selects ass for mkv if the input file contains subtitles: Many input files have subtitles that are not text based, trying to convert them (as is done by default) breaks re-encoding.
I am therefore mildly against changing the current mov behaviour.

comment:6 in reply to: ↑ 5 Changed 2 months ago by llogan

Replying to cehoyos:

I wonder if it isn't actually a bug that FFmpeg auto-selects ass for mkv if the input file contains subtitles: Many input files have subtitles that are not text based, trying to convert them (as is done by default) breaks re-encoding.

I did not consider that. Thanks for pointing it out.

I am therefore mildly against changing the current mov behaviour.

I have no ideas/suggestions for now. Feel free to manage however you think is best.

Note: See TracTickets for help on using tickets.