Opening .av ip camera video files in Linux

There are lots of cheap ip cameras in the market which saves the captured video files with .av extension and it can’t be viewed on Linux directly.

When you look at the one of those files with the file command, it basically says that plain data file:

$ file test.av
test.av: data

However, if you look at the file with ffmpeg -i you can see that it is an raw h264 video:

$ ffmpeg -i test.av
Input #0, h264, from '20.00.01_M.av':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 1280x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc

You can play this files with specifying --demux h264 option to vlc command like below:

$ vlc --demux h264 test.av

It will be played perfectly.

You can also convert this raw h264 files to another format which will be played without any further actions like that:

$ ffmpeg -i test.av -codec copy test.mp4
$ file test.mp4
test.mp4: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]