tip: A quick way to convert video container of a file

Forum Forums General Tips and Tricks tip: A quick way to convert video container of a file

  • This topic has 3 replies, 2 voices, and was last updated Jun 18-2:35 am by fatmac.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #23203

    I sometimes download stuff of youtube (music videos, short movies, etc) to watch on my tv. Unfortunatly, it won’t play some mp4 video files. I used to re-enconde those files to mkv, that my TV plays without problems, but I recently found a almost instant way to convert a video container (in my case, from mp4 to mkv) almost instantly, even on very low powered CPU’s (the reason why I’m publish this tip here in the antiX forum):

    Navigate your way to the video file you want to convert and, using the terminal, use ffmpeg:

    ffmpeg -i filename.mp4 -vcodec copy -acodec copy filename.mkv

    Where “filename.mp4” is the name of the file you want to convert and “filename.mkv” is the name of the converted file.
    (this tip is found in many places on the Web (for example https://stackoverflow.com/questions/40077681/ffmpeg-converting-from-mkv-to-mp4-without-re-encoding).

    The way I do this conversion is using copy and paste to simplify the process:
    1-copy the video file name from your file manager
    2-on the terminal enter: “ffmpeg -i ”
    3- paste the file name
    4- enter the rest of the command ” -vcodec copy -acodec copy ”
    5- paste the filename again, deleting the “.mp4” extension and typing “.mkv” and press enter. Wait some seconds while the file is converted…

    I hope this tip is helpfull to anyone else… At least it will be to be, if I ever lose this info, again 🙂



    You could make yourself a little script to do the conversion for you, only needing the file name (less extension) as the parameter ($1) – might make it easier for you in the future. 🙂

    # Just use the filename less extension as parameter
    ffmpeg -i $1.mp4 -vcodec copy -acodec copy $1.mkv

    Then you just call it mp4-2-mpv, (or anything else you like), & run it as so,

    mp4-2-mpv filename

    Linux (& BSD) since 1999


    Thanks, fatmac!
    One of my problems is that I have very bad memory- if I don’t write everything down, I tend to forget stuff and have to search how to do everything from scratch, that’s a big part of the reason why I share so many “how to”‘s here in the forums…
    I used to have a script, probably very similar to the one you made, on my old desktop computer. I clicked the video file in spacefm and the computer started the conversion… I did that script shortly before that PC went to old computer’s heaven after some 16 years of use (I have to take it to be repaired, it’s not dead, only taking a very long nap 🙂 ).
    I was amazed when I found out how much faster converting a video (and audio) container was, compared to re-enconding the video file- It used to take, sometimes about an hour, now it takes a couple of minutes or less…


    • This reply was modified 1 year, 3 months ago by PPC.

    I tend to write down things that I know I will need again into a little notebook, been doing that ever since I started out using computers, some things I’ve ditched, like DOS commands & programming, as I won’t be using them again, but I forget how to do things too, & having that little notebook saves a lot of searching online. 🙂

    Linux (& BSD) since 1999

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.