Log in

View Full Version : late video and "wave" effect


lucrus
29th July 2009, 09:34
Hello *,

I'm new here, I've bought a JVC Everio HM200GZ and I have only Linux (Ubuntu 9.04).
My final target (quite far away for now) is to create a script that converts my MTS files into MKV files, and another script that takes the MKV and burns a DVD-video, but let that target alone for now.

My Everio saves MTS files to SD cards. I've managed to demux them with tsdemux (it gives me .264 elementary streams) and to create a Matroska video with MKV files creator. The whole process takes few seconds only, so I assume there's no transcoding taking place here, and the resulting file is basically the same video data I have on the SD card (please correct me if I'm wrong in this assumption).

I've also managed to play the resulting mkv files with totem (other players such as vlc and mplayer yeld horrible results, xine does not even dare to open them).

Even totem has two problems while playing those files:
1. audio and video are not in sync, e.g. video plays slower than the audio (which plays at the correct rate)
2. when something on the scene moves, the subsequent video frames have a "wave effect" (I don't know how else to name it). You can see the effect in this two vidcaps:

vidcap1 (http://img226.imagevenue.com/img.php?image=54280_waves1_122_56lo.jpg)

vidcap2 (http://img204.imagevenue.com/img.php?image=55966_waves2_122_110lo.jpg)


First time I saw that effect I assumed it was being caused by video compression, but playing the same scenes directly on the Everio does not show those waves, so, assuming video data is the same (my assumption above), I think that it has to be a mistake I make somewhere in the process of creating or playing my mkv files.

For the first problem I first suspected the cause being a different framerate between audio and video:

$ mkvinfo myvideo.mkv
+ EBML head
|+ Segment tracks
| + A track
| + Track number: 1
| + Track UID: 1344522326
| + Track type: video
| + Default duration: 40.000ms (25.000 fps for a video track)
| + A track
| + Track number: 2
| + Track UID: 1299255631
| + Track type: audio
| + Default duration: 32.000ms (31.250 fps for a video track)
(I cut parts of the output)

However even changing the video framerate to 31.25 didn't solve the problem. I then tried to stretch the video to the audio length and that worked ok. Now I wonder if there's an automated way to tell mkvmerge to stretch the video to the length of the audio track (or if there's any command line tool that tells me the length of a .264 video track and a AC3 audio track).

Got any tips for me?

Thanks in advance,
Lucio.

Blue_MiSfit
29th July 2009, 10:16
Post a sample vid?

You're correct in assuming that the video and audio aren't being transcoded in anyway. You're simply remuxing.

I think somewhere a flag is being set incorrectly, hence the desync'd audio. Not sure about the video "wave" effect you're talking about, though it could be a side effect of interlacing not being handled correctly.

Have you tried doing this the easy way - with ffmpeg or mencoder? I'm not much of a Linux guy, and know of several ways to do what you're trying to achieve in Windows, but bear with me :D

In any case, a sample will help ;)

~MiSfit

akupenguin
29th July 2009, 10:21
For the first problem I first suspected the cause being a different framerate between audio and video:
Audio frames do have a duration, which is what mkv measured. But that duration is determined by the audio format (e.g. AC3 is 1536 samples per frame; 1536 / 48KHz = 32ms), and there's no particular reason it should have any relation to the video framerate, even when they're correctly synced.

nm
29th July 2009, 11:59
I'm new here, I've bought a JVC Everio HM200GZ and I have only Linux (Ubuntu 9.04).
My final target (quite far away for now) is to create a script that converts my MTS files into MKV files, and another script that takes the MKV and burns a DVD-video, but let that target alone for now.
Kdenlive might be the easiest option if you don't need a scripted solution and the captures require some cutting or effects work. Kdeinlive can export directly to DVD video.

My Everio saves MTS files to SD cards. I've managed to demux them with tsdemux (it gives me .264 elementary streams) and to create a Matroska video with MKV files creator. The whole process takes few seconds only, so I assume there's no transcoding taking place here, and the resulting file is basically the same video data I have on the SD card (please correct me if I'm wrong in this assumption).
That's correct. You could also try tsMuxeR (http://www.smlabs.net/tsmuxer_en.html) for de/remuxing.

I've also managed to play the resulting mkv files with totem (other players such as vlc and mplayer yeld horrible results, xine does not even dare to open them).
Ubuntu has an outdated MPlayer version (1.0rc2). VLC is more recent. Both should handle H.264 in MKV better than Totem though, so what's the problem exactly? Have you tried playing the original TS files?

Even totem has two problems while playing those files:
1. audio and video are not in sync, e.g. video plays slower than the audio (which plays at the correct rate)
In addition to a potential video framerate problem, the H.264 decoder (libavcodec) used by Totem might not be fast enough on your CPU and the GStreamer framework can add some overhead. MPlayer and VLC are a bit faster, but you probably need ffmpeg-mt or hardware decoding through VDPAU to decode these 1080i/p H.264 streams in real time.

2. when something on the scene moves, the subsequent video frames have a "wave effect" (I don't know how else to name it).
Looks like the video is interlaced and you aren't deinterlacing it on playback. When Totem scales the video to fit the window size, the weaved lines (combing) get interpolated to those waves you see.

| + Default duration: 40.000ms (25.000 fps for a video track)
Is your camera a PAL (25i, 50p) or NTSC (30000/1001i, 60000/1001p) version? Mkvmerge defaults to 25 fps when importing H.264 elementary streams, but the actual source framerate could be 30000/1001~=29.970

roozhou
29th July 2009, 12:54
AFAIK GZ-HM200 has 50/60p mode. Next time you should try recording in progressive mode instead of interlaced mode.
Interlacing is a poison in digital world so you should get rid of it if possible.

lucrus
29th July 2009, 14:52
Ubuntu has an outdated MPlayer version (1.0rc2). VLC is more recent. Both should handle H.264 in MKV better than Totem though, so what's the problem exactly? Have you tried playing the original TS files?


You're right, vlc handles those files better than totem, I don't know why the first time I tried vlc it gave me a worse playback compared to totem. However the "combing" is still there, thiner lines, but still very visible and disturbing.


In addition to a potential video framerate problem, the H.264 decoder (libavcodec) used by Totem might not be fast enough on your CPU and the GStreamer framework can add some overhead. MPlayer and VLC are a bit faster, but you probably need ffmpeg-mt or hardware decoding through VDPAU to decode these 1080i/p H.264 streams in real time.


It's a Intel(R) Core(TM)2 Duo CPU T5670@1.80GHz. Is it supposed to be enough?


Looks like the video is interlaced and you aren't deinterlacing it on playback. When Totem scales the video to fit the window size, the weaved lines (combing) get interpolated to those waves you see.


How do I tell vlc (or whatever) to deinterlace it on playback?


Is your camera a PAL (25i, 50p) or NTSC (30000/1001i, 60000/1001p) version? Mkvmerge defaults to 25 fps when importing H.264 elementary streams, but the actual source framerate could be 30000/1001~=29.970


How do I tell what version is my camera? All I know is the model: GZ-HM200BE. Sure a 29.97 fps setting would fit better my video which is slow by now, but I can't find any mention on the camera about being PAL or NTSC.


Have you tried playing the original TS files?


Same visual result (combing) but in addition VLC seems to need more CPU (sloppy video and 100% cpu usage).

lucrus
29th July 2009, 14:56
AFAIK GZ-HM200 has 50/60p mode. Next time you should try recording in progressive mode instead of interlaced mode.
Interlacing is a poison in digital world so you should get rid of it if possible.

My GZ-HM200 menus don't seem to have any items about progressive/interlaced mode. I've tried recording in UXP quality but I get the same combing problem. Could the progressive mode be called some other way in the menus?

nm
29th July 2009, 16:54
It's a Intel(R) Core(TM)2 Duo CPU T5670@1.80GHz. Is it supposed to be enough?
Most likely not without VDPAU or ffmpeg-mt (you can get it to work with MPlayer by building it yourself, VLC may be trickier). Which GPU do you have?

Anyway, realtime playback is not necessary for re-encoding.

How do I tell vlc (or whatever) to deinterlace it on playback?
In the Video menu, there should be a Deinterlacing submenu that exposes some basic filters. Try Bob and Linear.

For better software deinterlacing, get a recent MPlayer version (from here (https://launchpad.net/~rvm/+archive/mplayer), or build it yourself) and try "-vf yadif=1". Yadif is definitely too slow for your CPU at 1920x1080, so don't expect realtime playback. SMPlayer (http://smplayer.sourceforge.net/) is a nice GUI for MPlayer.

How do I tell what version is my camera? All I know is the model: GZ-HM200BE. Sure a 29.97 fps setting would fit better my video which is slow by now, but I can't find any mention on the camera about being PAL or NTSC.
Where did you buy it from? Models sold in Europe and Australia can be 25i or 50p. In USA and Japan you'll get 30i or 60p (more precisely 30000/1001i or 60000/1001p). Some devices might support both framerates, others only support NTSC.

Here I use the notation 25i, which refers to the framerate. 50i is just another way to say the same thing, only referring to the field rate.

Same visual result (combing) but in addition VLC seems to need more CPU (sloppy video and 100% cpu usage).
That also implies incorrect framerate in your MKV file. The original TS is 30000/1001i, which needs to be decoded faster than 25i and therefore causes a higher CPU load.

My GZ-HM200 menus don't seem to have any items about progressive/interlaced mode. I've tried recording in UXP quality but I get the same combing problem. Could the progressive mode be called some other way in the menus?
I checked the manual and looks like the camera only records 1920x1080 video as interlaced. The 50p and 60p references on the Web probably concern HDMI output. Apparently the camera can deinterlace the video and therefore feed it properly to computer monitors that don't have built-in deinterlacing chips.

mäger
9th October 2009, 01:02
hi

i'm trying to compress a Lagarith Lossless avi file into h.264 video file, but the problem is that audio is not in sync with the video.
audio starts earlier from the very first frames i think...
any idea what could be the problem?
i'm usin one pass - avg bitrate video and lame mp3 160kbps audio... (in virtualdub)

xvid 2pass comes out fine, but that has not got the good quality picture...

thanks

lucrus
9th October 2009, 14:44
hi

i'm trying to compress a Lagarith Lossless avi file into h.264 video file, but the problem is that audio is not in sync with the video.
audio starts earlier from the very first frames i think...
any idea what could be the problem?


Unfortunately not. However in my case I solved all my problems with

$ ffmpeg -deinterlace -i 00001.MTS -target pal-dvd -acodec copy -sameq 00001.mpg

hi
i'm usin one pass - avg bitrate video and lame mp3 160kbps audio... (in virtualdub)


I don't know virtualdub, maybe you could have better luck starting a new thread.

mäger
17th October 2009, 20:17
ok thanks. solved everything with megui :p