3

i'm trying to run the following line on FFmpeg that will basically "re-format" an MKV file to MP4 without doing any re-encoding and also embed SRT subtitles onto the MP4 output:

ffmpeg -i test.mkv -i test.srt -newsubtitle -acodec copy -vcodec copy test.mp4

Without the "-i test.srt -nwesubtitle" bit, it seems to work just fine; however, with it I get the following output:

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (5000000/104271) -> 23.98 (24000/1001)

Stream #0.0(eng): Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
Stream #0.1(eng): Subtitle: 0x0000
Metadata:
  title           : English
Stream #0.2(jpn): Audio: aac, 48000 Hz, stereo, s16
Metadata:
  title           : Japanese 2.0
Stream #0.3(eng): Audio: aac, 48000 Hz, stereo, s16
Metadata:
  title           : English 2.0
Stream #0.4(eng): Subtitle: 0x0000
Metadata:
  title           : English Songs & Signs
Stream #0.5: Attachment: 0x0000
Metadata:
  filename        : MyriadPro-Bold.ttf
Stream #0.6: Attachment: 0x0000
Metadata:
  filename        : MyriadPro-RegularHaruhi.ttf
Stream #0.7: Attachment: 0x0000
Metadata:
  filename        : ChaparralPro-BoldIt.ttf
Stream #0.8: Attachment: 0x0000
Metadata:
  filename        : ChaparralPro-SemiboldIt.ttf
Stream #0.9: Attachment: 0x0000
Metadata:
  filename        : epmgobld_ending.ttf
Stream #0.10: Attachment: 0x0000
Metadata:
  filename        : epminbld_opening.ttf
Stream #0.11: Attachment: 0x0000
Metadata:
  filename        : Folks-Bold.ttf
Stream #0.12: Attachment: 0x0000
Metadata:
  filename        : GosmickSansBold.ttf
Stream #0.13: Attachment: 0x0000
Metadata:
  filename        : WarnockPro-LightDisp.ttf
Stream #0.14: Attachment: 0x0000
Metadata:
  filename        : epmgobld_ending.ttf
Stream #0.15: Attachment: 0x0000
Metadata:
  filename        : GosmickSansBold.ttf
Stream #0.16: Attachment: 0x0000
Metadata:
  filename        : Marker SD 1.2.ttf
Stream #0.17: Attachment: 0x0000
Metadata:
  filename        : MyriadPro-Bold.ttf
Stream #0.18: Attachment: 0x0000
Metadata:
  filename        : MyriadPro-RegularHaruhi.ttf
Stream #0.19: Attachment: 0x0000
Metadata:
  filename        : MyriadPro-SemiCn.ttf
test.srt: Invalid data found when processing input

I tried adding "-r pal", "-r ntsc" or "-r 23.98" thinking it was framerate issue with no change.

2 Answers 2

3

FFmpeg was calling "test.srt: Invalid data found when processing input" because it simply could not handle the SRT file. I ran the -codecs options and sure enough the "srt" codec was not listed.

To fix this I complied ffmpeg from source, using the configure options to enable subtitles.

Apparently the FFmpeg that can be found on the Ubuntu repositories is complied with subtitles turned off.

1
  • Good stuff, thanks for posting your solution here. :) Jul 3, 2011 at 21:28
1

SRT subtitles aren't officially supported in MP4, and many of the devices that play MP4 won't be able to play the SRT subtitles contained within them. Wide compatibility is the main reason to use MP4 over MKV, so you might as well stick with Matroska.

To combine multiple files into a single MKV, use mkvmerge from mkvtoolsnix:

mkvmerge -o output.mkv input.mkv input2.srt

If you insist on using MP4, MP4Box is the equivalent tool (from gpac):

MP4Box -out output.mp4 -add input.mkv -add input2.srt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .