audioffmpegfilteringresolutionvideo-subtitles

ffmpeg : is there a simple way to edit the video resolution, but keep all audio and subtitles


I would like to lower video resolution - usually from .mkv files - but to keep all possible audio tracks (might be only one, might be several) and subtitles (might be none, might be several) from the original one. I also would like to keep as many encoding parameters as I can from the original video file (especially those I do not understand).

I am still new to ffmpeg : at first the idea seemed simple, but after many attempts, it seems it is more complex than that. Do I have to use the -filter_complex option ? It seems to be an overkill (or overcomplex) for what I thought to be an easy conversion, but I might be wrong.

I tried to combine -vf scale=-1:720 with -c copy -map 0, which gave me an error that I now understand, but I am stuck with the next step.

Any lead on to achieve that ? Could it be done with ffmpeg only or would I need a script ?


Solution

  • Your try should've worked. For example,

    ffmpeg -i input.mp4 -vf scale=-1:720 -map 0 -c:a copy -c:s copy output.mp4
    

    grabs all the streams from the input, passes all video streams through the scale filter, and copies all audio and subtitle streams.

    What was the error?

    keep as many encoding parameters

    This it cannot do. When you reencode, it's on you to pick the parameters to best match those possibly used for the input.