I have a video file (with no audio stream) taken from a Lorex CCTV DVR. The video file has a suffix of ".264" which I assume means its format is raw h264. I cannot play this video on certain media players including the default player on an Apple tablet. I would like to convert the file to another format that is more universally useable, for example mp4. 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. Furthermore, when I tried to play it using the Ubuntu Videos application the application returned a widow containing the error message: "An error occurred This file contains no playable streams."

file --mime-type ~/somePath/foo.264
~/somePath/foo.264: application/octet-stream

mediainfo ~/somePath/foo.264
Format:AVC; Format profile:Baseline@L2; Width:352 pixels; Height:240 pixels

Would somebody instruct me how to convert the .264 file to a .mp4?

  • have you tried running file --mime-type foo.264? or mediainfo foo.264? That will tell you if the file really is a valid video file. If you don't already have it installed and it isn't available as a package for your system, the mediainfo web site has packages for windows, mac, several linux distros, and FreeBSD, as well as source code.
    – cas
    Commented May 17, 2016 at 2:39
  • I have not tried either of those commands. But I do know that it is a valid video file because I have watched it on mplayer with the command: mplayer -fps 30 ~/somePath/foo.264
    – EricVonB
    Commented May 17, 2016 at 3:19
  • Those commands will also tell you what kind of video file it is. Actual facts are better than assumptions - there's no guarantee that a .264 "extension" means that it is h.264. It might be, or it might not be. BTW, try handbrake to convert it to an mp4.
    – cas
    Commented May 17, 2016 at 4:02
  • The command [file --mime-type ~/somePath/foo.264] returns [~/somePath/foo.264: application/octet-stream]. And [bar@host:~$ mediainfo ~/somePath/foo.264] returns a lot, including: Format:AVC; Format profile:Baseline@L2; Width:352 pixels; Height:240 pixels
    – EricVonB
    Commented May 17, 2016 at 5:03
  • 1
    You probably need a new version of avconf and/or ffmpeg. I just downloaded your video (hint: next time, give the direct download link, not a link to the drive web-app page that requires javascript and a login account - googledrive.com/host/0B0ej35Mor2U-d1NNMFNoZUhuNU0 ), and using the exact same command you used, it converted from an 80MB file of unknown format to an 18MB mp4 file.
    – cas
    Commented May 18, 2016 at 9:34

1 Answer 1


How to Play and Convert .264 files to mp4:

How to play .264 files:

  • Install VLC if you dont have it
  • run vlc
  • Select "All" to show all nest preference settings
  • In "input / codecs" column, select "Demuxers"; Demuxers are used to separate audio and video streams.
  • Changing the default setting [Automatic] to [H264 video demuxer]
  • Open the .264 file, making sure to select "All Files"

How to convert the .264 video files to MP4 files:

  • Select [Convert/Save...] from the drop menu of Media
  • A [Open Media] window will pop-up, click "Add" to add the .264 file needs to convert. Then, click "Convert/Save" button to continue.
  • Selecting " Video - H.264 + MP3 (MP4)" in Profile list, click "Config" icon to config the profile setting.
  • Selecting the "MPEG-TS", not the MP4/MOV (default), then go to "Audio codec" to disable audio.
  • Go to "Video codec" tab, choosing "H-264" in Codec listing, then select/check "Keep original video track". This step is very important.
  • Clicking "Save" to save the profile setting, then click "Browser" to select the directory where the generated file need to be stored. Thereafter, click "Start" to proceed file generating. Just several seconds, you will get files with .ts file extension.
  • Run the Handbrake software, import the .ts file to convert.

From Here: https://www.unifore.net/ip-video-surveillance/how-to-play-264-video-files-from-ip-cameras-dvrs.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .