Sunday, July 11, 2010

YouTube quality problems when using x264 and 640x480

A little YouTube video quality problem is puzzling me right now, if I upload a 480p video I get what looks like artifacts produced by a bad de-interlacing algorithm:

If I however scale the video to 1280x1024 before the upload, the result in 480p on YouTube looks fine and close to the original 480p data:

Searching around on the net hasn't brought any clues so far. The original video was produced with HandBrake and matches from what I can tell YouTubes recommended video formats.

Uploading the video as 360p directly doesn't seem to have this problem, but that of course means lower quality then 480p.

Update: I still have no idea on the cause of the pixelation or how to fix it without reencoding, a rencoding of the video into flv however seems to work:

mencoder inputvideo.mkv -oac mp3lame -ovc lavc -lavcopts vcodec=flv:vbitrate=500:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3 -o outputvideo.flv

Update: The problem seems to be h.264/x264 specific, Using MPEG4 as codec works as well:

mencoder raw.avi -o mplayer-mpeg4.avi -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=800

Update: I solved the problem now with the MPEG4 codec for those of my videos that had that issue. While doing so I ran into the problem that Youtube doesn't offer import/export of annotations, thus no way to copy over annotations from the badly encoded video to the cleaned up one, luckily there is a workaround. This video explains how one can import and export annotations. Short summary, use to get an xml of your annotation and then the Firefox Tamper Data Add-On to fudge your annotations into a POST request.

Update: Two questions on the YouTube help forum referencing this problem:


qubodup said...

What happens if you re-encode the video using the same resolution?

Grumbel said...

Same problem, at least with most of the containers and codecs I have tried. Using ffmpeg to create a flv container seems like it might work, but requires a reencode of the video (-vcodec copy produces something that Youtube doesn't understand).

Unknown said...

Really trustworthy blog. Please keep updating with great posts like this one. I have booked marked your site and visit Youtube Support also Call Toll Free No +1-800-231-4635 For US/CA.

Unknown said...
This comment has been removed by a blog administrator.
Unknown said...
This comment has been removed by a blog administrator.