brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ffmpeg -c copy changes the container without re-encoding

Ffmpeg
~/tips/ffmpeg-copy

ffmpeg -i movie.mkv -c copy movie.mp4

Moves a video into another file format in seconds, without re-encoding or quality loss.

A video that will not play in one app often plays fine in another once it sits in a different file format. You rarely need a slow re-encode for that.

ffmpeg -i movie.mkv -c copy movie.mp4

-c copy copies the audio and video streams as they are into a new container. It finishes in seconds, uses almost no CPU and loses no quality, because nothing gets decoded.

Caveat: not every stream fits in every container. If ffmpeg complains that a codec is not supported in MP4, that stream has to be converted, or you keep the MKV. Text subtitles from an MKV usually need -c:s mov_text for MP4.

Further reading: ffmpeg documentation

More Ffmpeg tips ffmpeg -stream_loop 2 -i in.mp4 -c copy out.mp4 ffmpeg -i in.mp4 \ ffmpeg -i video.mp4 -i video.en.srt -map 0 -map 1 -c copy -c:s mov_text -metadata:s:s:0 language=eng video-subs.mp4 ffmpeg -i film.mkv -map 0:v -map 0:a:0 -c:v copy -c:a aac -b:a 192k -ac 2 film-stereo.mkv ffmpeg -i talk.mp4 -vn -c:a copy talk.m4a All Ffmpeg tips (38) All topics

Link