AVC inside ASF Container

The first question is why?

Why would a company wrap up a h264/AVC camera stream inside the ASF container format? I dont think its the best partnership and even upon research, the general consensus appears to be that its problematic.

Player and File details

Player and File details

The player interface is a very common one. It has been rebranded by a few companies and has a few different colour variations. A few linked file extensions are .dav, .dev, .mpg, .mp4 …and now .asf!

If you were greeted with a disk full of .asf extended files only then you could easily mistake them for wmv format videos. These are the common type used within the .asf container. However, when taking a closer look, they are not – they are h264 streams. And what does the pixel size say above – 704 x 576.

Wrong – the raw streams are 352 x 576!

After doing the usual Forensic File Analysis with Mediainfo, FFprobe etc it was time to attempt a rewrap of these files.

What I found worked best was to extract the stream as a raw h264 first and then place this into an avi. For some reason ffmpeg wouldn’t do it correctly in one hit.

The other thing to look for is the small ‘avi’ button at the bottom of the player. It is possible to re stream the asf file into a .dav file. This file will then play in another version of the player that has the ‘avi’ button enabled. The problem with this is that you cant see what is going on and what is happening to the footage.

Re-wrapping these files was mainly an exercise to assess what was going on within the file due to the frame size issue. Even if you export a frame from within the player it comes out at 704 x 576. For me, I would prefer to get the raw unadulterated frame from within the h264 stream and then assess which resizing filter is best from within Photoshop.

I’m the one doing the resizing then – and not the player.

A few links on wikipedia:



By Spreadys Posted in EEPIP

6 comments on “AVC inside ASF Container

  1. How did you extract the H264 stream from the .asf? Would the same process work with a .dav file? I’m currently not succeeding with FFMpeg and the -f h264 switch.

    • Hi Gareth,
      what’s the entire ffmpeg command you are using? Mine was something along the lines of:
      ffmpeg -i input.asf -vcodec copy output.h264
      I kept is very sparse to test what worked and what didn’t. I presume you have ensured that it is a h264 in the first place by running it through Mediainfo…. sorry – had to ask!
      Dealing with the .davs are easier. they are not packaged up within the asf container so they are able to be rewrapped. let me know what files you are starting with (dav / asf etc) and then the ffmepg command in full and I will see what I can come up with.

      • Mediainfo states it is an “MPEG-4 Visual”
        Although it also states Format_Settings_Matrix/String: Default (H.263).

        I hadn’t actually used MediaInfo before so I’ll be having a proper play with that later.

        The command I used in ffplay was ffplay.exe -f h264 -i originalfile.264 (where originalfile is the full filename).

        The file is not playing back correctly in the player as it is only partially recovered from a badly authored optical disc. Audio will play but not video bar sporadic pixel distortion. Do you have a technique to recover individual frames if the video will not playback as a whole?

  2. Hi again Gareth,
    Within your command line try this first…
    ffplay -f m4v input.dav

    You should then have it playing in the ffplay window! I have tested this with a mpeg4 based .dav and it worked ok.
    To get this into an indexed avi:
    ffmpeg -f m4v input.dav -vcodec copy -vsync drop -f avi output.avi

    In my test this produces a file that plays back and scrubs well with virtualdub when using the ffmpeg input driver.

    Hope it helps… and as for damaged original files – you may be out of luck and its definately a little more in depth than I can put here!!!

    • That worked – to an extent. I first used the -f m4v to attain playback – the visuals are extremely degraded – high levels of pixel smearing are distorting the image and other than the clock not very much is being picked up. An ac-tex damaged message is frequently appearing.

      I’m going to attempt the transcode and see if any of the i-frames are better recovered when viewing in VirtualDub.

      Is there a way you know of to just extract i-frames as a starting point to see if any of them are intact?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s