Chad Perrin: SOB

23 January 2009

framerate adjustment for crappy Flash video

Filed under: Geek — apotheon @ 11:58

About a week and a half ago, I talked about Flash Workarounds for FreeBSD — especially YouTube. I mentioned that my current approach to dealing with Flash on my FreeBSD laptop is to use the open source swfdec plugin for Firefox, which is apparently Flash 5 compliant and catching up with later Flash versions. Unfortunately, that doesn’t really solve the problem of Flash video on YouTube. My solution for that is to use youtube-dl to download YouTube videos:

youtube-dl 'http://www.youtube.com/watch?v=foo' -o bar.flv

In that example, just replace the foo with whatever mess of mixed characters identifies the video you want to watch, and bar with whatever you want to use as a filename before the .flv filename extension.

Then, with the file downloaded, I use MPlayer to play the video, after having installed the appropriate media codecs. It’s all pretty simple to set up on FreeBSD, though installing codecs may be a bit more of an onerous task on many Linux distributions.

There are many YouTube videos that, when downloaded and played using MPlayer, end up with the video and sound out of sync, however. This tends to take the form of video playing at some incredibly high framerate while sound plays at the usual pace, so that you get a few seconds into a five-minute video’s sound before it stops because all the video has already played at a rate so fast you probably didn’t even get to see everything — and what you did see definitely didn’t look right.

There’s a simple fix for the problem in MPlayer’s command line options, but it’s not exactly easy to find in the (extremely lengthy) manpage: use the -fps option to set a different video framerate. I’ve found that 30 tends to work well. Try that and, if it’s not perfect, adjust to suit your needs. The command to play your bar.flv file with the video framerate adjusted would look something like this:

mplayer -fps 30 bar.flv

Nice and simple. Yeah?

3 Comments

  1. Isn’t it just easier to not use flash at all for the content providers? What ever happened to the avi as a means of mass distributing video?

    Comment by Joseph A. Nagy, Jr. — 24 January 2009 @ 09:53

  2. I don’t know that AVI is the ideal container format — but there are definitely a bunch of more open formats than Flash that would work well. I wish content providers like YouTube would consider using some of them.

    Comment by apotheon — 24 January 2009 @ 11:56

  3. […] There is also the option of using a Firefox extension such as DownloadHelper to grab Flash video content from the Web. If you run into problems with some low-quality Flash videos from YouTube whose audio and video do not sync up properly, MPlayer supports framerate adjustment for crappy Flash video. […]

    Pingback by How to deal with Adobe Flash and Reader vulnerability | IT Security | TechRepublic.com — 27 July 2009 @ 08:33

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License