computers and technology & geek & linux, unix, and open source & personal & youtube 23 Feb 2008 12:07 pm

Convert FLV to MPG and MP3

Use ffmpeg to convert flv to mpg:

ffmpeg -i old-file.flv new-file.mpg

Use mplayer to copy mp3 from flv

mplayer -dumpaudio old-file.flv -dumpfile new-file.mp3

Script to speed things up:

#!/bin/sh

# This script downloads YouTube videos and converts them
# You will end up with an MPG video and MP3 audio of each YouTube movie
# You need to install the following three programs:
# youtube_dl, ffmpeg, and mplayer

# Use this script at your own risk!
# Make sure that you understand how it works before you use it!

# USAGE:
# Make a file called videos.txt with the URL of 1 YouTube video on each line.
# Don't leave any blank lines in the file
# Put the videos.txt file in an empty folder along with this script
# run this script with the following commands:
# $ ./youtube_downloader.sh
# It will take a long time to run, depending on
# how many videos you have in your videos.txt file.

while read inputline
do
  youtube_url="$(echo $inputline)"
  youtube-dl $youtube_url
done < videos.txt

# Convert the flv files to mpg and mp3 files
for i in *.flv
do
  ffmpeg -i $i $i.mpg
  # comment out the next line if you don't want MP3's extracted
  mplayer -dumpaudio $i -dumpfile $i.mp3
  # The next line deletes all FLV files in the current directory to cleanup
  rm $i
done

Source: Download YouTube Videos on Linux and Convert FLV to MPG Movies and rip MP3 Audio | Webmaster Tips

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply

You must be logged in to post a comment.