[FFmpeg-user] Add subtitles and chapter metadata in one pass?

John Finlay finlay at moeraki.com
Mon Oct 12 23:20:36 EEST 2020


I have used a command like the below with success in the past:

$ ffmpeg -i avfile.mkv -i srtfile.srt -i metadata.txt \
      -map 0:0 -map 0:1 -map 1 -map_metadata 2 \
          -c:v libx264 [ various options ] \
          -c:a copy \
          -c:s srt \
          -c:d copy \
             out.mkv

Maybe something like that will work for you.

John


On 10/12/2020 12:29 PM, George Welch wrote:
> Howdy,
>
> I need to start with a movie file that has audio and video, and to
> reencode the video and add subtitles and chapter markers.
>
> I can add the chapters in a first pass, and then add the subtitles in a
> second pass, and that works fine.  But I can't seem to find the right
> command to add subtitles and chapters in one pass.
>
> For example, here is a sequence that does work:
>
> $ ffmpeg -i avfile.mkv -i metadata.txt \
>       -map 0:v -map 0:a -map_metadata 1 \
>           -c:v libx264 [ various options ] \
>           -c:a copy \
>               temp.mkv
> $ ffmpeg -i temp.mkv -i srtfile.srt \
>       -map 0:v -map 0:a -map 1:s \
>           -c:v copy \
>           -c:a copy \
>           -c:s srt \
>               out.mkv
>
> However, I would like to skip the intermediate file.  Here is the
> command I am trying which does *not* work:
>
> $ ffmpeg -i avfile.mkv -i srtfile.srt -i metadata.txt \
>       -map 0:v -map 0:a -map 1:s -map_metadata 2 \
>           -c:v libx264 [ various options ] \
>           -c:a copy \
>           -c:s srt \
>               out.mkv
>
> Can anyone tell me a command that will work, and hopefully explain what
> I have wrong?
>
> Thanks!
>
> --George
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list