The behavior you're describing is not a known feature of FFmpeg. FFmpeg doesn't automatically add subtitle tracks from SRT files with matching filenames when you are performing the described operations.
You may have some other process or script that's merging the SRT file with the MP4, but FFmpeg by itself will not automatically mux in an SRT file unless you specifically instruct it to.
If you want to ensure that the resulting MP4 file does not include subtitles, you should:
- Ensure no other scripts or processes are running that may be causing this.
- Explicitly specify which streams you want to copy. For instance, you can specify
-c:v copy -c:a copy to only copy video and audio streams and ensure that no other streams (including subtitles) are copied.
Also I should mention that the behavior of an SRT subtitle file automatically being picked up by video players when it has the same name as the video file is a common feature in many media players, such as VLC, MPC-HC, and others.
When you have a video file, say
video.mp4, and an SRT file named
video.srt in the same directory, many players will automatically detect the SRT file as a subtitle track for that video and will show the subtitles when the video is played. However, if the SRT file is in a different directory or has another name, the player won't automatically pick it up.
Also, FFmpeg allows you to mux (i.e., combine) video and subtitle streams into a single container format, such as MKV or MP4.
To mux a video and an SRT subtitle into a single file, you would use a command similar to this:
ffmpeg -i video.mp4 -i subtitle.srt -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng output.mp4
Here's a breakdown of the command:
-i video.mp4: This specifies the input video file.
-i subtitle.srt: This specifies the input subtitle file.
-c:v copy: This copies the video codec without re-encoding.
-c:a copy: This copies the audio codec without re-encoding.
-c:s mov_text: This specifies the codec to use for the subtitle stream. mov_text is commonly used for MP4 containers. If you were muxing into an MKV container, you might not need to specify this, as MKV typically uses the SRT format directly.
-metadata:s:s:0 language=eng: This sets the language metadata for the subtitle stream to English. You can change
eng to another ISO 639-2/B code to indicate another language.
output.mp4: This is the name of the output file.
Answered, September 23rd, 2023