LinuxQuestions.org
Review your favorite Linux distribution.
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 12-10-2008, 03:41 AM   #1
Steve W
Member
 
Registered: Mar 2007
Distribution: Ubuntu 12.04, XUbuntu 12.04
Posts: 509

Rep: Reputation: 44
Correcting wrong speed FLV videos?


Sometimes videos I watch/download on YouTube or similar have been encoded so that the video runs faster than the sound (i.e. the video is 2x speed, and the sound is normal speed, so they quickly become unsync'ed). It's only some videos, not all of them.

Is there software that will enable me to separate the sound and video of an FLV (or convert it to a different format where I can do this)?

I saw on the internet that Linux has a utility called "Mencoder".

(i) Would this do it?
(ii) Is there a better utility I should use instead?

Thank you for any advice you can give.

Steve
 
Old 12-11-2008, 02:27 PM   #2
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,109
Blog Entries: 1

Rep: Reputation: 868Reputation: 868Reputation: 868Reputation: 868Reputation: 868Reputation: 868Reputation: 868
There's ways to correct that in realtime with the player.

There's various formats out there. Europe types being PAL at 25 fps. Americas being NTSC at 30 fps. Blueray being 24 fps. TV being 60 fps interlaced. And other factors like aspect ratio.

mplayer -ao alsa -vo xv -fps 25 youtube.flv

otherwise:

ffmpeg -i source.flv -an -y video_only.flv
ffmpeg -i source.flv -vn -y audio_only.wav

or:

mplayer source.flv -dumpaudio -dumpfile audio_only.wav
mplayer source.flv -dumpvideo -dumpfile video_only.flv

And many many many other options. IME, most can be corrected in the player. Although not that useful if putting them on a dvd or other media type. -fps for mplayer. -monitoraspect or -aspect if you want to tweak the width/height relationships. As DVDs encode 720x480 (NTSC) video which can be either 16:9 or 4:3 (1.78 or 1.33) at playback. You can also use -vf scale -zoom -x 720 -y 540 (or 854x480) depending on how you want to deal with various quirks. Some of the technical specs are lost when encoding to various formats, so the player has to assume best guess. Which isn't always right.

HTH
 
Old 12-12-2008, 08:16 AM   #3
Steve W
Member
 
Registered: Mar 2007
Distribution: Ubuntu 12.04, XUbuntu 12.04
Posts: 509

Original Poster
Rep: Reputation: 44
Wow - I didn't know you had that many options with mplayer. I shall try that out when I get home. I'll re-post to let you know how I got on.

I thought mplayer just let you play media files straight up, and that was that. I think some research on the web may be required into its full capabilities...

Steve
 
Old 12-12-2008, 09:15 AM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,116

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Quote:
Wow - I didn't know you had that many options with mplayer.
That many?
You don't know the half of it: See man mplayer (when you have a weekend free).
There's not much it will not do, when asked nicely.
 
Old 12-12-2008, 09:50 AM   #5
Steve W
Member
 
Registered: Mar 2007
Distribution: Ubuntu 12.04, XUbuntu 12.04
Posts: 509

Original Poster
Rep: Reputation: 44
One thing I have noticed, with Linux, is that after viewing a YouTube or similar Flash video, I can go into /tmp and copy it off to another folder, and keep it for viewing later in MPlayer. However, this file will not play on my Windows PC at work, even though it will play videos straight from youtube. I imagine Windows users must need separate software to allow them to play flash videos offline.

I wonder if one of the MPlayer options (when I get down to checking them out) will allow me to edit the video, in terms of saving just bits of it, like just the first 10 seconds, or last 2 minutes, that sort of thing...

Steve
 
Old 12-12-2008, 10:00 AM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,116

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Linux has plenty of video editors, but none (that I am aware of) for FLashVideo.
Conversion to avi is easy though. Here's a little script:
Code:
#!/bin/sh
# Convert flash video to an avi
# See http://www.linux.com/articles/56642
if [ -z "$1" ]; then
  echo "Usage: $0 {-divx|-xvid} list_of_flv_files"
  exit 1
fi

# video encoding bit rate
V_BITRATE=1000

while [ "$1" ]; do
  case "$1" in
    -divx)
      MENC_OPTS="-ovc lavc -lavcopts \
        vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoaspect"
      ;;
    -xvid)
      MENC_OPTS="-ovc xvid -xvidencopts bitrate=$V_BITRATE:autoaspect"
      ;;
    *)
      if file "$1" | grep -q "Macromedia Flash Video"; then
        mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame \
          -lameopts fast:preset=standard -o \
          "`basename $1 .flv`.avi"
      else
        echo "$1 is not Flash Video. Skipping"
      fi
      ;;
  esac
  shift
done
It uses mencoder, from the same stable as mplayer, so, again, there are lots of options.
 
Old 12-13-2008, 02:20 AM   #7
Steve W
Member
 
Registered: Mar 2007
Distribution: Ubuntu 12.04, XUbuntu 12.04
Posts: 509

Original Poster
Rep: Reputation: 44
Turns out, now I check, that I didn't have "mplayer" installed at all, so have never used it. The "Movie Player" I was using was actually Totem. So after a quick apt-get install, I have mplayer on my system.

Big long pause when I start it up, for some reason. Also, when I use the command line instruction suggested above to sync the video with the sound (turns out it needs to be 13.45 fps!), the mouse doesn't work for any playback options and the shell keeps popping up "No bind found for key 'MOUSE-BTN2' and such like, while the movie is playing.

Anyway, the best thing is for me to take a long, leisurely look at those man pages, and any other tutorials/help available online.

However, I have achieved my initial objective of synchronising video and sound on these problem videos, so thanks Shadow_7 and Tredegar for your advice and assistance.

Steve
 
  


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
Wrong colors w/ Videos - Gforce 8800 GT JesterDev Linux - Hardware 5 11-06-2009 05:32 PM
converting all kind of videos to flash ( FLV zafar466 Linux - General 1 07-25-2008 05:17 AM
LXer: Convert .flv (Google Videos) to .mpg using ffmpeg LXer Syndicated Linux News 0 07-25-2007 06:31 AM
CPU speed wrong ? no way Linux - Hardware 3 02-04-2006 09:45 AM
Videos Wrong Colour MDK10 tuxismyhero Mandriva 0 06-10-2004 07:09 PM

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

All times are GMT -5. The time now is 05:35 AM.

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