I'm trying to convert a video to lower quality using the following comand :
ffmpeg -i in.mkv -c:a copy -map 0:5 -map 0:6 -map 0:7 -c:s copy -map 0:9 -c:v h264_nvenc -rc constqp -qp 23 -map 0:0 out.mp4
With stream 0:9 being a subtitle. I get
Stream mapping:
Stream #0:5 -> #0:0 (copy)
Stream #0:6 -> #0:1 (copy)
Stream #0:7 -> #0:2 (copy)
Stream #0:9 -> #0:3 (copy)
Stream #0:0 -> #0:4 (h264 (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[mp4 @ 0x55c6edd3a640] track 0: codec frame size is not set
[mp4 @ 0x55c6edd3a640] track 1: codec frame size is not set
[mp4 @ 0x55c6edd3a640] track 2: codec frame size is not set
[mp4 @ 0x55c6edd3a640] Could not find tag for codec subrip in stream #3, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:4 --
If I change -c:s copy
with -c:s mov_text
, the error is gone, but then the subtitle doesn't work. Everything else seems to be fine.
You are outputting MP4, but it only supports mov_text
(a generic name for streaming text format [14496-17]) softsubs. However, player support is not universal.
Use a better player (VLC, mpv, Pot Player), use a different output container format (such as MKV), or use hardsubs (see subtitles filer).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With