LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   VLC - Audio and Video are out of sync when recording streams (http://www.linuxquestions.org/questions/slackware-14/vlc-audio-and-video-are-out-of-sync-when-recording-streams-4175494218/)

glupa4e 02-07-2014 11:17 PM

VLC - Audio and Video are out of sync when recording streams
 
Hello,

i have the following problem - i record streams from Onlive TV and then try to edit them. I am doing it using VLC. I upgraded to the version 2.1.3. from Alienbob's repository. I can record the stream, it os OK. When i replay it in VLC, it looks like OK, but when i play it with Mplayer or Kaffeine - i notice that the sound precedes the video and i have to correct it. I decode the audio using ffmpeg. Then i edit the video with OpenShot or Kdenlive and finaly need to edit the video and audio so that they are synchronous. It is not very esy to do it and additional effort for me. I tried out the PlayOnLinux version ov VLC with Wine, but there are no menus there and the problem remains. I know that this is not probably Slackware spceific problem but i would appreciate if you share your experience.
Thank you!

Doc CPU 02-08-2014 04:20 AM

Hi there,

Quote:

Originally Posted by glupa4e (Post 5113796)
i have the following problem - i record streams from Onlive TV and then try to edit them. I am doing it using VLC. I upgraded to the version 2.1.3. from Alienbob's repository. I can record the stream, it os OK. When i replay it in VLC, it looks like OK, but when i play it with Mplayer or Kaffeine - i notice that the sound precedes the video and i have to correct it.

this is a common problem with digital videos. Actually, audio and video streams often have some offset in a A+V stream, but each audio and video stream is supposed to have timestamps embedded into them, so that a player can match those up against each other. VLC does honor these timestamps and plays the streams in sync, but many other players do not. I can confirm that flaw for Mplayer, as well as the integrated player of Avidemux.

The typical solution for this is to demux the file into separate video and audio streams, and then re-multiplex them with timestamps adjusted against each other. Until now, I've only had MPEG2 videos from my TV unit, and I demux them with ProjectX (which fixes some errors in the video stream during the process), then remux them with mplex. However, ProjectX can only handle MPEG2, it cannot deal with MPEG4, which is normally used with HD video. I don't know a good and easy-to-use tool for demuxing MPEG4 video yet, let alone a versatile one that can deal with different video types.

I used to do this sync thing during post-processing (strip commercials, convert into MPEG4) with Avidemux - however, Avidemux can only apply a constant offset over the entire file (and the actual offset sometimes changes during the recording); plus, Avidemux can't detect the correct offset automatically - you have to find it out manually by guessing and trying.
I still have to revert to that method for some recordings, though, because some videos make ProjectX crash in mid-operation; or ProjectX detects bogus video resolutions that apparently change every few frames, even though the video plays fine. Luckily, this is rare.

Quote:

Originally Posted by glupa4e (Post 5113796)
I know that this is not probably Slackware spceific problem

Indeed, it's not. ;-)

[X] Doc CPU

glupa4e 02-08-2014 06:44 AM

Hello Doc CPU,

thank you for your post. As a workaround i found a way to split the video and audio. I extract the audio using ffmpeg. Then i edit the video in OpenShot or Kdenlive. Then i create a new video from the edited audio and video but this manual guessing is sometimes difficult. Unfortunately those offsets exist. Sometimes OpenShot or Kdenlive crashes but that is life.

dugan 02-08-2014 10:39 AM

Both MPlayer and VLC can deal with this by delaying the video or audio stream during playback.


All times are GMT -5. The time now is 03:59 AM.