ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i A.mkv -map 0 -acodec flac -compression_level 8 -ac 2 -c:v hevc_vaapi -c:s copy B.mkv
The -map 0
means try to transfer all streams, with -c:s copy means copy the subtitles (either SRT or PGS) to new video/audio file.
There is a glitch where this could fail to start if you have a thumbnail image with the -map 0
flag, so be careful.
Sources:© 2019 to 2025 Branden Gilfoil & © up to 2025 for respective owners.