Add subtitles and chapter metadata in one pass?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Add subtitles and chapter metadata in one pass?

George R. Welch
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
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Add subtitles and chapter metadata in one pass?

FFmpeg-users mailing list
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
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Add subtitles and chapter metadata in one pass?

Moritz Barsnick
In reply to this post by George R. Welch
On Mon, Oct 12, 2020 at 15:29:53 -0400, George Welch wrote:

> 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?

ffmpeg has loads of useful console output. Please post the uncut
console output along with the actual command line. The same for the
successful command would also be useful.

Otherwise we are just guessing.

Thanks,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Add subtitles and chapter metadata in one pass?

George R. Welch
In reply to this post by FFmpeg-users mailing list
Thank you John.  Your command works.

And actually, I now see that my command (which was functionally
identical to yours) is also working, so I apologize to the list for
adding the noise.

The reason that I thought the command was failing is because of the way
ffmpeg logs it progress to the terminal.  While it is running, one gets
an updating line such as:

frame=21239 fps=101 q=30.0 size=  274914kB time=00:11:49.14
bitrate=3175.8kbits/s speed=3.36x

In my experience, this line was constantly updating about once per
second and you can watch the "time=..." part increase as the encoding
progresses.  However, with the inclusion of subtitles this line behaves
differently.  The "frame=" part still increases about once per second,
but the "time=" part only increments at the next subtitle.  I had seen
that freeze and assumed ffmpeg stopped working.

It is very weird that this informational line behaves the way it does,
but since ffmpeg is working away I'm not bothered by it.

Thanks all!

--George


On 10/12/20 3:20 PM, John Finlay via ffmpeg-user wrote:

> 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
>> [hidden email]
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".