LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-19-2004, 06:50 PM   #1
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
yuvfps causing A/V sync issues


I hope someone around here has experience with video encoding; I'm fairly knowledgeable about it so far, but have hit a stumbling block:

I'm doing encoding of video to DVD from various arbitrary formats using a script I wrote. Since the input format is arbitrary, it could have just about any frame rate. So far, my script is working beautifully for 23.976 fps (film) and 29.97 fps (NTSC) input rates, as well as 25 fps (PAL). However, I recently encountered a batch of DivX3-encoded AVIs that have framerates like 14.986 or 24.963. At least, that is how mencoder is identifying them; they may very well be variable framerate or some silliness.

So I'm using yuvfps of the mjpegtools package. It has a deceptively simple interface: give it a YUV stream containing video (easy), and tell it what framerate you want the output to be (also easy):

Code:
cat stream.yuv | yuvfps -r 30000:1001
(30000:1001 being equal to 29.97). Peachy. For film rate (23.976), it's necessary to give it the input rate:

Code:
cat stream.yuv | yuvfps -s 24000:1001 -r 30000:1001
Easy. Now, I say "deceptively" because that seems to be where the simplicity ends; if I have a 14.986fps video, and pass that to yuvfps as the source framerate, A/V sync issues ensue; they match at the beginning but get progressively more out-of-sync as the video goes on, until they're completely whacked at the end. Sometimes very whacked; for some, the video will be over in 2 minutes, and the audio keeps running for 20 minutes. I'm beginning to suspect this is a "feature" of yuvfps.

OK, so some brief background: I am feeding yuvfps a stream from mplayer, by using the 'yuv4mpeg' video output driver. That's the only way I know to get a YUV stream, and I need the YUV stream to do all the rest of the encoding stuff. Mplayer gets suicidal when it tries to do mpeg encoding on its own, so I gotta have the mjpegtools doing that part.

It is possible to get mencoder to adjust its own output framerate. If I could do that, I wouldn't have to use yuvfps at all. However, that only works with mencoder, not mplayer. Why not use mencoder then? mencoder can't output a YUV stream. I've a catch-22.

So here are my questions, boiled down to their juicy essence:

How can I make yuvfps output 29.97fps without causing sync issues?

or

How can I get a YUV stream out of mencoder?

Any help or advice would be greatly appreciated. Oh, and one solution that I already thought of, but don't like, is to do two-pass encoding: use mencoder to get the right framerate, dump it into a raw video file, then play it with mplayer to get the YUV stream. It already takes anywhere from 4 to 16 hours to encode a 2-hour movie; I don't want to increase that any more than I have to.

Last edited by wapcaplet; 07-19-2004 at 06:54 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Serious issues with sound/alsa - laggy, unresponsive, and doesn't sync correctly. dragonslay Linux - Software 0 01-06-2005 08:42 PM
ATI Drivers - Flickering (Sync Issues?) Ehuwiko Slackware 1 11-26-2004 12:06 PM
Display Sync issues w/ RH 9 Canis Linux - Newbie 4 07-22-2004 05:54 AM
Mandrake 10.0 causing sound card issues dissolved Linux - General 3 07-03-2004 03:04 PM
no horizontal sync? screen resolution issues. scabies Linux - Hardware 4 07-02-2004 12:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration