I am researching a seemingly different conversion problem and I ran across this basic issue. The MP4 file has no chapters, a single title (that is, no multiple titles like some DVDs), a single audio track, a single video track, and, a single subtitle track. Just as a test to prove that nothing should change, I ran this command:
ffmpeg -i input.mp4 -c copy output.mp4
When I looked at the output file, the subtitle track is missing. Obviously, I don't want that to happen, but, I don't know why it happened. I have attached the console output from that command. Anybody know what is going on?
+ Reply to Thread
Results 1 to 10 of 10
-
-
I see from another thread that a user lost subtitles while converting from MK4 to MP4. One reply mentioned that MP4 does not support as many subtitle formats as MKV. I know that subtitles can be text-based or image-based, but, I don't know what other formats there might be. I am trying to learn and use ffmpeg for all of my conversions. According to the ffmpeg console output, the information related to the MP4 subtitle track is:
mov_text (tx3g / 0x67337874), 793,72, 0 kb/s (default) -
Use clever FFmpeg-GUI.
Load your mkv, main, multiplex, your streams are already loaded, select mp4 as container, set your target file, click on multiplex. done.
If your subtitle is srt, ass or ssa then it will be automatically converted to mov_text, the only subtitle accepted by the mp4 container.Last edited by ProWo; 31st May 2021 at 10:13. Reason: typo
-
Last edited by the_steve_randolph; 31st May 2021 at 11:28.
-
-
OK, both of these solutions worked:
ffmpeg -i input.mp4 -c:v copy -c:a copy -cmov_text output.mp4
ffmpeg -i input.mp4 -map 0 -c copy output.mp4
When I do my original statement, I look at the console output and towards the end, it has a label called "stream mapping" that is missing the subtitle stream. With those other two commands, under that label it has the subtitle stream listed like this:
Stream #0:2 -> #0:2 (copy)
I accept that these work and my original statement does not work. Now the question is: why?
Why is "-c copy" getting the video and audio streams but not the subtitle stream? Maybe ffmpeg's default stream handling doesn't have enough love/respect for the subtitle stream?
BTW, this statement also works:
ffmpeg -i input.mp4 -c:v copy -c:a copy -ccopy output.mp4
As a side note, how can I put a command statement inside of a "Code:" box like y'all have done?Last edited by the_steve_randolph; 31st May 2021 at 15:45. Reason: typos and removing the link to an app added by the site - but, can't get rid of the smilie
-
-
OK, I found this: [link](https://ffmpeg.org/ffmpeg.html#Automatic-stream-selection)
Under "4.1.1 Automatic stream selection" there is this statement:
"for subtitles, it is the first subtitle stream found but there’s a caveat. The output format’s default subtitle encoder can be either text-based or image-based, and only a subtitle stream of the same type will be chosen."
So, given my issue, this would seem to indicate that the default subtitle encoder for MP4 is NOT text-based since my MP4's subtitle track is "mov_text". That would explain why the "Stream #0:2 -> #0:2 (copy)" is not shown in the console output from my original statement but "Stream #0:2 -> #0:2 (copy)" is shown/included in the two solutions provided above.
Am I understanding/interpreting this correctly? -
Similar Threads
-
Need help with ffmpeg - converting m4s to mp4
By yarinaz in forum Video ConversionReplies: 1Last Post: 14th Oct 2020, 10:34 -
Set a default subtitle track in a .mp4 file (with BOX4)
By Alice in forum SubtitleReplies: 1Last Post: 4th Oct 2020, 16:38 -
FFMPEG Conversion from MKV to MP4 returns a empty MP4 file?
By lolmaisine in forum Video ConversionReplies: 4Last Post: 6th Mar 2019, 07:45 -
How to convert MKV to MP4 (Without losing subtitle)
By Juniorzkie in forum Newbie / General discussionsReplies: 5Last Post: 3rd Apr 2018, 15:32 -
FFMPEG converting 4k MP4 files.
By Phillipj in forum Video ConversionReplies: 11Last Post: 30th Jul 2016, 16:07