I have a file called ~/somePath/foo.264, containing video from a surveillance camera's DVR. I am unable to view this video on several media players including the default media player on an Apple tablet and the Ubuntu Videos application. I am able to view it using MPlayer on Linux. How can I transform the video in this file to something that is more universally useable? I tried the following command at Linux terminal:

avconv -i ~/somePath/foo.264 -vcodec libx264 -f mp4 ~/somePath/foo.mp4

but the output mp4 file was basically empty, with a total size of 285 bytes. The source file, foo.264, is 80 MB. Maybe I need to re-encode the video; maybe I need to place the video into a container of another format; or maybe the solution is something else. I am a novice at audio-video editing, but I am slightly more experience at Linux operating system.

PS. When I do the command

mediainfo ~/somePath/foo.264

from linux terminal I receive the following output:


Complete name: ~/somePath/foo.264

Format : AVC

Format/Info : Advanced Video Codec

File size : 79.1 MiB


Format : AVC

Format/Info : Advanced Video Codec

Format profile : Baseline@L2

Format settings, CABAC : No

Format settings, ReFrames : 2 frames

Format settings, GOP : M=1, N=30

Width : 352 pixels

Height : 240 pixels

Display aspect ratio : 3:2

Color space : YUV

Chroma subsampling : 4:2:0

Bit depth : 8 bits

Scan type : Progressive

PPS. I have already posed a related question, https://unix.stackexchange.com/questions/283548/convert-264-to-mp4-using-avconv , on the Unix & Linux Stackexchange.

3 Answers 3


You need to convert the codec used to encode the video to something that the players you are trying to use support. MPlayer supports a wider range of codecs than many players.

To allow you to view the video in other players you need to transcode the video using an application like ffmpeg. The command below will provide the conversion you need:

ffmpeg -i foo.264 -c:a aac -c:v libx264 -preset medium foo.mp4
  • i - input file
  • c:a - set audio codec to transcode to. Here I chose AAC
  • c:v - set video codec to transcode to. libx264 is used to transcode to H.264, one of the most common and widely used video codecs. Most players should be able to play files encoded with H.264.
  • preset - used to quickly define the H.264 encoding parameters. Choose from ultrafast,superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. There is obviously a trade-off between quality and transcode speed here.

After running this command I could play the video you uploaded in QuickTime on OS X.

If you use -copy or don't specify a codec, then ffmpeg will use the same codec as the source. So the command

ffmpeg -f h264 -i foo.264 -c copy foo.mp4

Will change the container around the video to mp4, but not the video encoding itself. You can read more about the difference between containers and codecs here.


The information realted to input files seems perfectly fine. Can you share the file or file link here. I will experiment with it and update you about the results.


You should just be able to place it in a MP4

ffmpeg -i foo.264 -c copy foo.mp4

Maybe if they don't detect the format, then

ffmpeg -f h264 -i foo.264 -c copy foo.mp4
  • I ran the second command. Then when I tried to play the output file in Ubuntu Videos app I got the following error message: "An error occurred GStreamer encountered a general stream error." Here is the output of [mediainfo ~/somePath/foo.mp4]: General; Complete name : ~/somePath/foo.mp4; Format : MPEG-4; Format profile : Base Media; Codec ID : isom; File size : 79.2 MiB; Duration : 18mn 1s; Overall bit rate : 614 Kbps; Encoded date : UTC 1904-01-01 00:00:00; Tagged date : UTC 1904-01-01 00:00:00; Writing application : Lavf57.29.101; ... continues ...
    – EricVonB
    Commented May 18, 2016 at 6:44
  • ... continued ... Video; ID : 1; Format : AVC; Format/Info : Advanced Video Codec; Codec ID : avc1; Codec ID/Info : Advanced Video Coding; Duration : 18mn 1s; Bit rate : 614 Kbps; Width : 352 pixels; Height : 240 pixels; Display aspect ratio : 3:2; Frame rate mode : Constant; Frame rate : 25.000 fps; Bits/(Pixel*Frame) : 0.291; Stream size : 79.1 MiB (100%); Encoded date : UTC 1904-01-01 00:00:00; Tagged date : UTC 1904-01-01 00:00:00
    – EricVonB
    Commented May 18, 2016 at 6:48
  • The source is not a standard-compliant file. If you run ffmpeg -i foo.264 foo.mp4 with a recent version of ffmpeg, it will throw some errors but produce a mostly intact generic MP4.
    – Gyan
    Commented May 18, 2016 at 7:03

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.