Supposed H.264 Clip won't open in Vegas

PixelStuff wrote on 2/28/2016, 5:50 PM
I have a clip from a 3MP security camera that is supposedly compressed in H.264 in an AVI wrapper, but Vegas 13 won't open it. However VLC and Windows Media Player will play it without problem.

What is the best way to go about troubleshooting the issue here?

One thing I noticed is that VLC can convert it to an H.264 clip in an MP4 wrapper (which also plays fine in VLC and WMP), and Vegas will then open it, however the frames (only in Vegas) play out of order with a few playing then jumping back a few frames then skipping ahead a few more, then jumping back where it left off, etc.

So something weird is going on.


NormanPCN wrote on 2/28/2016, 6:23 PM
AVI files were never intended to support codecs like AVC/H.264. There can be support issues as you have found out. To get Vegas to support AVC in AVI (Video for Windows) you are going to have to install a Video for Windows codec supporting AVC. Even with a codec install there can still be problems with AVC in and AVI file.

Depending on the audio codec used you should be able to remux the AVI file into an MP4 or MOV file and Vegas will directly open those. This is fast an no loss in quality. If AAC audio you can remux into MP4. If PCM then you can remux into MOV. Vegas directly opens Quicktime MOV files that have AVC video and PCM audio without using Quicktime.
PixelStuff wrote on 2/28/2016, 9:19 PM
Well the x.264 codec allowed the clip to open in Vegas, but it creates some bizarre speckling and psychedelic colors wherever there is motion. Could this be purely from the AVI container or is there something else going on? Again, VLC and WMP seem to play it fine.

Here is a clip if anyone wants to experiment. vms-export.avi

NormanPCN wrote on 2/28/2016, 10:01 PM
That seems indicative of a type of problem one can have with AVC in AVI. Video for Windows is a one frame in and one frame out setup. This is fine for Intra codecs but can cause problems for others. The main problem is mostly with B-frames from what I understand. B-frames are forward referencing.

Some software like VLC that does not use Video for Windows to read/write AVI might not have problems whereas one that does, like Vegas, might.
PixelStuff wrote on 2/28/2016, 11:56 PM

How would you go about remuxing an AVI file? I downloaded MeGUI and tried it's Muxing tool, but it's giving me an error and won't run the file.
NormanPCN wrote on 2/29/2016, 12:13 AM
The example file you posted has no audio so you can just remux that into MP4 for import into Vegas. I just tried Avidemux to remux and import into Vegas. All was good.

Open the file in Avidemux.
Choose "Copy" for the video codec.
Since there is no audio, the audio setting does not matter. "Copy" is fine.
Choose the MP4 or MP4v2 muxer option. I tried MP4.
Then save the file.
musicvid10 wrote on 2/29/2016, 6:39 AM
B-frames are not natively supported in AVI.
One of the drawbacks of using legacy vfw wrapper.
PixelStuff wrote on 2/29/2016, 11:17 PM
Thanks. This worked perfectly.
john_dennis wrote on 3/1/2016, 1:17 AM
Though it's not written for .avi, tsMuxer rewrapped your file into a Vegas Pro editable type (.ts and/or .m2ts) in one click.

You have to enter *.avi or search for all files (*.*) to bypass the file type filter, but it works in this case.

Mediainfo appears to report the frame rate incorrectly. The file appears to be 15 fps. Set "no resample".

Did someone steal your forklift?
astar wrote on 3/1/2016, 12:44 PM
You could try FFmpeg and see if that will convert the file to an .mp4 format. From the folder the file is in, you can try FFPLAY and the file name to see if ffmpeg will play it back correctly. From there, re encode the file with the option "-g 1" this will produce an all intra frame version of the file. Also make sure to add a "-r 30000/1001 or 30 or 24" depending on the frame rate. 30000/1001 is 29.97. Using the latest version of FFmpeg, your statement would look something like.

ffmpeg -i "filename" -c:v h264 -preset medium -x264opts colorprim=bt709:transfer=bt709:colormatrix=bt709:fullrange=off -r 30000/1001 -g 1 -pix_fmt yuv420p -b:v "choose a bit rate"k -sar 1:1 -sws_flags lanczos -an -filter:v scale="1280:720 or 1080 depending on frame size" -c:a aac -ac 2 -ab 128k "output file name".mp4

Sound track is sort of important with AVI (Audio Visual Interleave,) so make sure the sound is coming with to the new file. I have seen strange issues with AVI when just striping the video out.

I see the a solution was found, posting for others info searching the same issue.
PixelStuff wrote on 3/3/2016, 11:26 PM
"Did someone steal your forklift?"

No. That was just an innocuous test clip.

And FYI this came from a VMS called DW Spectrum / Nx Witness. So if anyone else gets clips from one of these systems, now you know how to get them into Vegas.