PDA

View Full Version : X264 and mov files from the Kodak ZI8 vidcam


lchiu7
5th April 2010, 22:09
I record movies regularly using the Kodak ZI8 HDCam. The movies are in mov format (h.264/AAC) and are either 1080p/30fps or 720p/60fps.

I am using Windows 7 Professional.

I have been trying to encode them to a H.264 format that is friendlier to play and smaller. But I have encountered a strange bug or behaviour with the encode.

Firstly I rename the files to mp4. I do that else Sony Vegas can't open them (trying to use Vegas to edit the files).

Using megui (though it really doesn't matter if I use megui or just x264 command line) I encode them to H.264 using say a standard HD profile. I then mux that output back with the original AAC audio using txmuxer. While it all goes fine, the audio and video always goes out of sync - by more than a second sometimes.

From a few posts on some other sites I decided to use Vegas to try to encode and downloaded x264vfw which appears to be a h.264 plugin encoder based on the x264 code base.

So I import the video into Vegas (8). I then choose Render as and have a bunch of options.

Two that are interesting are FFDShow and the x264vfw both of which have options to encode as H.264.

Using either option, the output video file shows the same out of sync behaviour. So this suggests to me that there is some strange attribute of the file that is causing x264 to have sync isseus.

Out of interest, those same file re-encoded by the Arcsoft Media encoder (Kodak edition, supplied with the camera) encode fine as you would expect!

For those who are interested, a sample file from the camera can be downloaded here. The picture quality is not that good since all I did was play some video on my monitor and capture it using the recorder so I could have content where I could see dialogue and therefore determine any sync issues.

http://www.adrive.com/public/7b87559095deae19b82086f22a71836b43cf6e9ea41dfc56208a93d1255221db.html

The file is called charmed.mp4 and is about 50MB

Thanks for any insight into this problem.

Inspector.Gadget
5th April 2010, 22:59
I just opened it in Avidemux and re-encoded the video with x264 and copied the audio to an MP4 container. Your camera does frame tripling (~10 fps becomes ~30fps) so some decoders are maybe not compatible. Audio sync was fine through Avidemux.

lchiu7
5th April 2010, 23:56
I just opened it in Avidemux and re-encoded the video with x264 and copied the audio to an MP4 container. Your camera does frame tripling (~10 fps becomes ~30fps) so some decoders are maybe not compatible. Audio sync was fine through Avidemux.

Thanks for the info. Can you tell me what settings you used in avidemux for encoding x264? I just used the default but upped the bitrate and it produced a file that had highly blocky video and stuttering playback. But it was fine when I encoded to xvid.

I wonder if I have some incorrect codec settings?

Inspector.Gadget
6th April 2010, 00:14
I just used CRF 20, didn't change anything else. I'm using the latest Win32 build by Lord Mulder. Maybe Avidemux makes some x264 settings persistent, so you may need to change some things the first time around to get it set up properly (e.g., defaulting to CRF). Also, the transcoding preserves the frame tripling done by your camera in a way similar to hard telecine, so that soft metadata is discarded but the video is displayed as intended. If you wanted to be sneaky and save space (and could find a working decoder to get these files into Avisynth), you could select the first of every three frames and then use AssumeFPS to play the video back at 10/1001 FPS (1/3 of 30/1001 FPS), and everything would look exactly the same.

lchiu7
6th April 2010, 01:09
That's interesting. I will give it a try when I get home and see what avidemux build I have.

Also interesting about the frame tripling. So if I were to shoot in 720p/60fps there could be frame sextupling (if that is the term!)

Blue_MiSfit
6th April 2010, 01:18
You can try FFMS2 to get the video decoded into AviSynth. I usually have good results using this on H.264 MOVs.

AviSynth should also be able to remove the duplicate frames. Selectevery(3,0) should do it..

~MiSfit

lchiu7
7th April 2010, 00:46
OK - tried it again with the latest Lord Mulder build and got the same result - an unplayable file (VLC, WMP or QT) that was jerky and had out of sync audio.

Out of interest took the file to another machine which has a fairly fresh Win7 build on it and surprisingly it played fine and in sync with WMP.

Now I know on my machine I had fiddled with the codec priorities with the Win7DSFilter tool and the default for decoding H.264 is ffdshow but when I set it back to Microsoft, it still played poorly.

At least I know the process works okay - it's just my main machine is not playing them back properly which matches Inspector.Gadget's report.

Next thing to check is if the encode from Vegas also plays fine on the other machine.

Thanks for the information.

kieranrk
7th April 2010, 06:15
I see no frame tripling syntax element in this at all. It would be an extremely bizzare camera that would film 1080p10 then frame triple it to 1080p30. Remuxing with ffmpeg to mkv played this fine.

lchiu7
7th April 2010, 11:25
I see no frame tripling syntax element in this at all. It would be an extremely bizzare camera that would film 1080p10 then frame triple it to 1080p30. Remuxing with ffmpeg to mkv played this fine.

Are you able to share your ffmpeg command line? I would like to try it out.

Thanks

buzzqw
7th April 2010, 12:08
should be

ffmpeg -i test.mov -acodec copy -vcodec copy -y test.mkv

BHH

Inspector.Gadget
7th April 2010, 14:50
I see no frame tripling syntax element in this at all. It would be an extremely bizzare camera that would film 1080p10 then frame triple it to 1080p30. Remuxing with ffmpeg to mkv played this fine.

Perhaps this is then a bug in MediaInfo or in the way the camera writes the MOV container...

lchiu7
8th April 2010, 02:23
should be

ffmpeg -i test.mov -acodec copy -vcodec copy -y test.mkv

BHH


That worked fine once I got the latest release of ffmpeg.

But playing the files isn't a problem for me. The original mov files from the camera play fine with QT - not so smoothly with VLC.

But I want to edit and re-encode them. Thanks to Inspector.Gadget's experiences I have worked out that for basic editing (cutting and joining clips) avidemux seems to work okay and I can re-encode to H.264 okay.

But editing videos in Vegas seems to be problemmatic. The editing is okay - adding effects, transitions etc. But outputting the video doesn't work too well. I guess I need to find another solution that's afforadable or a new camera!

easy2Bcheesy
10th April 2010, 14:33
I have Kodak Zi6 and it basically drops frames in low light. Extremely annoying. This may explain the doubled frames. In my "720p60" videos I can see anything from 15fps to the full 60 when lighting conditions are poor. Outside, or in decent light, it is fine.