Monday, October 16, 2006

trials of Cinelerra rendering, deja vu all over again

Well, four hours of overnight rendering yields a video I can't playback. I get this error:
int YUVStream::read_header(): y4m_read_stream_header() failed: bad header magic
int YUVStream::open_read(char*): Bad YUV4MPEG2 header: parameter out of range


Now what the F is wrong? Is it a problem with:
- my rendering options I chose?
- this version of ffmpeg in general?
- my project?

I wasted a number of hours on the first two possibilities. I finally saw two issues in my project:
1) for some reason, probably my big fat fingers, an audio transition was placed right at the beginning of the project (Timecode 00:00:00). I deleted this.
2) I noticed that for joins between separate videos on the same a/v tracks, the joins between the audio and video segments did not end at the exact same place:
http://content.serveftp.net/video/avmisaligned.png

To stop this, I went to the end of each segment, zoomed in all the way, and made sure that each video and audio segment ended at the exact same time. If they didn't end at the exact same time, I clipped off a bit of whatever audio or video track is dangling by using the mark in/mark out indicators and doing a "cut". After doing the cut, the segments aligned perfectly.
Even with these changes, however, I still get a similar version of my original error when I load the project:
int YUVStream::read_header(): y4m_read_stream_header() failed: bad stream or frame header
int YUVStream::open_read(char*): Bad YUV4MPEG2 header: parameter out of range
However, I can output it to a usable format, so I don't mind the rather ugly error messages. You'd thought I would have known better by now. ARGH!

Along the way tonight, I've been trying to help the Cinelerra CVS community debug a couple of errors:
1) the intermittent project hangs
2) MS MPEG4 render crashes

I synchronized my hvirtual directory twice and recompiled, once for v932 for the project hang problem and then v940 for the MS MPEG4 render crashes. Both took a couple interations, but it seems like the programmers have the problems licked. That's good. We've been pushing them pretty hard lately.

So, finally around 11pm, I've rendered the video to a usable DVD mpg. Now it's time to render once more; this time to iPod format. It looks like FFMPEG has removed the "-b" bitrate switch in favor of some quality scale switch, "-qscale". The higher the qscale, the lower the quality. To create videos with the same quality as the original, you can use the "-sameq" switch. Otherwise, a qscale of 4 will yield a decent quality video with some significant compression. I'd use h264, but I haven't been able to install it successfully. I may try VLC..

Update 2009/06/09
My understanding of the "-sameq" switch was a little naive. Robert Swain enlightens here:
http://rob.opendot.cl/index.php/2009/05/01/bit-rate-file-size-quality-misunderstandings/

You'll probably need to read it a couple of times like I did.
:)
*** end update ***

No comments: