Modify video file for viewing in generic media player 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:

General
Complete name: ~/somePath/foo.264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 79.1 MiB
Video
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 &amp; Linux Stackexchange.
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.