Can I add a codec for compatibility and automatically keep the original?
Hi, when I have a file using advanced subtitles, I often want to keep those for most devices but also add a basic subtitle format that is supported by my TV. So far, I've been converting the subtitles and after that, mapping the different subtitle format from the original and the output file into a final file in a second operation. Surely it would also be possible to map the original subtitles twice and then copy all codecs and convert only that of the second subtitle stream. I am planning to work on an automation (that works on a directory without knowing the number of streams in each file) and wondering, if ffmpeg maybe already has the kind of feature that I am looking for. Kind regards
Hi, On Sat, Nov 11, 2023 at 11:12:07 +0100, bbb wrote:
when I have a file using advanced subtitles, I often want to keep those for most devices but also add a basic subtitle format that is supported by my TV.
So far, I've been converting the subtitles and after that, mapping the different subtitle format from the original and the output file into a final file in a second operation. Surely it would also be possible to map the original subtitles twice and then copy all codecs and convert only that of the second subtitle stream.
Sure you can. You map the relevant input stream twice, and copy the first one while converting the second one. Something like: $ ffmpeg -i video.ext -map 0:v -map 0:a -map 0:s -map 0:s -c:v copy -c:a copy -c:s:0 copy -c:s:1 srt output.ext (Or perhaps convert the first one, if it's important for your TV.)
I am planning to work on an automation (that works on a directory without knowing the number of streams in each file) and wondering, if ffmpeg maybe already has the kind of feature that I am looking for.
I believe ffmpeg cannot automate the work on the number of streams. For the above scenario, you have to identify the streams first before constructing the command line. (So there's no "-map_if_exists 0:s"...) Cheers, Moritz
Hi, sorry for the late reply. I somehow missed your message. Thank you for the information. I was looking for something that could be fully automated and so I've ended up creating a script that generates temp files with only the converted subtitles and then joins all streams in the final result file. Kind regards On 13.11.23 14:43, Moritz Barsnick wrote:
Hi,
On Sat, Nov 11, 2023 at 11:12:07 +0100, bbb wrote:
when I have a file using advanced subtitles, I often want to keep those for most devices but also add a basic subtitle format that is supported by my TV.
So far, I've been converting the subtitles and after that, mapping the different subtitle format from the original and the output file into a final file in a second operation. Surely it would also be possible to map the original subtitles twice and then copy all codecs and convert only that of the second subtitle stream. Sure you can. You map the relevant input stream twice, and copy the first one while converting the second one.
Something like:
$ ffmpeg -i video.ext -map 0:v -map 0:a -map 0:s -map 0:s -c:v copy -c:a copy -c:s:0 copy -c:s:1 srt output.ext
(Or perhaps convert the first one, if it's important for your TV.)
I am planning to work on an automation (that works on a directory without knowing the number of streams in each file) and wondering, if ffmpeg maybe already has the kind of feature that I am looking for. I believe ffmpeg cannot automate the work on the number of streams. For the above scenario, you have to identify the streams first before constructing the command line. (So there's no "-map_if_exists 0:s"...)
Cheers, Moritz _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (2)
-
bbb -
Moritz Barsnick