Let me start by saying I'm not a video production guy. I am a programmer so I'm in over my head in certain areas. I've been trying to use ffmpeg to mess around with HEVC encoded video.

I was told it needs to be an HEVC encoded video, with the filetype of mkv, mov, avi, or something real common like that. I though mkv, mov, etc was their own encoding.

  1. Can someone help me understand what's being asked for? If I use the command ffmpeg command -i input.265 output.avi, won't it convert and encode it? I don't want that.

  2. How do I know what's an encoding and what a container?

  3. What commands or links can I look at so I can accomplish this task?

1 Answer 1


A container is what the name implies, a container for video data and audio data (and other misc. data). This might go a little bit under your know-how but just to make it easy to understand:

A video is made up by frames which are made up by pixels. A codec like h265/HEVC is there to take this pixel information and process it in a way that makes it a lot smaller than the raw pixel array, this process is called encoding. Most codecs do this in a lossy way which discards certain pixel information but trys to keep the image still look the same. The encoded image frame is mathematically not identical with the source but aims to look identical for the human eye.

The container is there to take this raw encoded stream and wrap it, many container formats provide extra meta information about the streams contained in it and support a variety of content other than video, like subtitles and audio information. The container is there to hold all this information, it doesn't alter the information like an encoder alters video or audio, it just holds on to them.

In order to mux (the term used when you mean you want to put a audio or video stream into a container, muxing will give you a lot of google results) your video into a container with ffmpeg you just have to tell ffmpeg to copy the existing stream instead of encoding it (in your case you provided it with no further information and it will just encode it to h264 which is the standard codec in ffmpeg when nothing is provided).

You do that by using -c copy which tells it to copy both audio and video from the source. You can also do -vcodec copy or -acodec copy to treat audio and video differently but this is more relevant to re-mux from an existing container which has audio and video data to another container.

In your case -c copy does the job just fine. Just add that to your command line and it should mux an avi for you. Though mkv is favorable over avi for h265 as its already the supported h265 container that DIVX uses for their h265 implementation. If just providing a filetype exension to your output file doesn't work like you expect you can also enforce a container by using -f mkv or -f avi.

This does what your client asked for, the h265 stream muxed into a container format without touching it.

  • 1
    Thanks that helped me understand things. Maybe you have idea why, but when i play the hevc in ffplay, its laggy but runs. After muxing, It plays the first 2 seconds and then freezes Oct 3, 2014 at 18:06
  • 1
    You can try muxing it into mp4 instead, that might be better supported by ffplay.
    – timonsku
    Oct 3, 2014 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.