On Sun, Sep 24, 2023 at 2:26 AM Michael Koch <astroelectro...@t-online.de> wrote: > Am 23.09.2023 um 23:31 schrieb Mark Filipak: > > ffmpeg -i "%SOURCE_NO_SUBS%" -i "%SUBTITLES_1%.srt" [-i > > "%SUBTITLES_2%.srt"..] -map 0 -map 1:s [-map 2:s..] -c:v copy -c:a > > copy -c:s mov_text "%TARGET%.mp4" > > I tested your example with two subtitle files, but it did only work > after I replaced > -map 0 > by > -map 0:v -map 0:a
Yes, replacing '-map 0' with '-map 0:v -map 0:a' excludes any existing subtitles. Well done, Michael. Next, I'd like to find a way to preserve existing subtitles. Observations: '-sn' is local; placed before the inputs, it applies to only the inputs so '-map 0:v -map 0:a' can go back to '-map 0'. However, '-c:s mov_text' is global; if present and SOURCE has existing subtitles, ffmpeg throws an error on the existing subtitles. The following works (but it excludes existing subtitles '-sn' on input): set SOURCE=e:\Movies1\a Boy and his Dog [1974].mp4 set SUBTITLES_1=g:\a Boy and his Dog [1974] set SUBTITLES_2=g:\a Boy and his Dog [1974] set TARGET=c:\TARGET.mp4 ffmpeg -sn -i "%SOURCE%" -i "%SUBTITLES_1%.srt" -i "%SUBTITLES_2%.srt" -map 0 -map 1 -map 2 -c:v copy -c:a copy -c:s mov_text -dn "%TARGET%" Attempt to add subtitles to a video that already has subtitles fails: ffmpeg -i "%SOURCE%" -i "%SUBTITLES_1%.srt" -i "%SUBTITLES_2%.srt" -map 0 -map 1 -map 2 -c:v copy -c:a copy -c:1:s mov_text -c:2:s mov_text -dn "%TARGET%" provokes "Invalid stream specifier: 1:s" ffmpeg -i "%SOURCE%" -i "%SUBTITLES_1%.srt" -i "%SUBTITLES_2%.srt" -map 0 -map 1 -map 2 -c:v copy -c:a copy -c:s:1 mov_text -c:s:2 mov_text -dn "%TARGET%" provokes "Automatic encoder selection failed Default encoder for format mp4 (codec none) is probably disabled." Do you have any ideas how to make '-c:s mov_text' local to just the added subtitles? _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".