[FFmpeg-user] Subtitles in mp4

Mark Filipak markfilipak.imdb at gmail.com
Tue Jun 10 20:21:49 EEST 2025


This assumes you've been following my posts in the last day.

My 5-step method is now a 4-step method, but, apparently, any further efficiency is not possible. I 
cover that at the bottom of this message.

: Step 1:
ffmpeg^
  -i y:\BDMV\STREAM\00000.m2ts^
  -dn^
  -filter_complex 
"[0:a:1]pan=stereo|FL<FL+0.5*FC+0.5*LFE+0.375*SL|FR<FR+0.5*FC+0.5*LFE+0.375*SR[stereo]"^
  -map 0:v -map "[stereo]" -map 0:a:0 -map 0:a:7^
  -c:v libx264 -x264-params^
  8x8dct=1:analyse=0x3,0x133:aq-mode=1:aq-strength=1.0:b-adapt=2:b-bias^
=0:b-pyramid=2:bframes=5:bitrate=2850:bluray-compat=0:cabac=1:chroma-m^
e=1:chroma-qp-offset=-2:constrained-intra=0:cplxblur=20.0:cqm=flat:dea^
dzone-inter=21:deadzone-intra=11:deblock=1,-1,-1:direct=auto:fast-pski^
p=0:filler=0:interlaced=0:intra-refresh=0:ipratio=1.40:keyint-min=23:k^
eyint=240:lookahead-threads=3:mbtree=1:me=umh:merange=30:nal-hrd=none:^
nr=0:open-gop=0:psy-rd=1.00,0.00:psy=1:qblur=0.5:qcomp=0.60:qpmax=69:q^
pmin=1:qpstep=4:ratetol=1.0:rc-lookahead=50:ref=5:scenecut=40:sliced-t^
hreads=0:slices=4:subme=7:threads=12:trellis=1:vbv-bufsize=78125:vbv-m^
axrate=62500:weightb=1:weightp=2^
  -c:a:0 ac3 -c:a:1 copy -c:a:2 copy -c:s:0 copy^
  "c:\2001, A SPACE ODYSSEY [1968] step1.mp4"

'-c:s:0 copy' does not work -- there are no subtitles in the mp4. So, imagine it removed.
By the way, '-c:s:0 dvdsub' and '-c:s:0 mov_text' don't work, either.

: Step 2:
ffmpeg^
  -i "y:\BDMV\STREAM\00000.m2ts"^
  -map 0:s:0 -s 1920x1080 -c:s copy^
  "c:\2001, A SPACE ODYSSEY [1968] step2.sup"

Step 2 does work. So, pgssub-in-sup is okay but pgssub-in-mp4 is not okay.

: Step 3:

There is no Step 3, not anymore -- .sub, .idx, .mkv, and mkvextract are no longer needed.

: Step 4:
"c:\Program Files\Subtitle Edit\SubtitleEdit"^
  "c:\2001, A SPACE ODYSSEY [1968] step2.sup"

: Step 5:
ffmpeg^
  -i "c:\2001, A SPACE ODYSSEY [1968] step1.mp4"^
  -i "c:\2001, A SPACE ODYSSEY [1968] step2.srt"^
  -map 0 -map 1^
  -c:v copy -c:a copy -c:s mov_text^
  "c:\2001, A SPACE ODYSSEY [1968].mp4"

Isn't it curious that subtitles don't work in Step 1, but they do work in Step 5?
FACT: Subtitles do work in mp4, so don't say that they don't work.
FACT: FFmpeg is able to make subtitles in mp4 if the subtitles come from an srt.
FACT: FFmpeg is not able to make subtitles in an mp4 if it is also making video.




More information about the ffmpeg-user mailing list