Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By wapcaplet at 2004-06-07 23:16
If you've ever tried to find good software for creating VCD, SVCD, or DVD video discs in Linux, you may have met with some frustration, as I did. There are a lot of great video-conversion tools available, but most of them are run from the command-line with a bunch of arcane arguments. This is a little script I wrote that converts any video that can be played by mplayer into an appropriately-encoded mpeg for VCD, SVCD, or DVD. Parts of the script (in particular, the segment that extracts information from the video using tcprobe and perl) were stolen from the divx2cvcd script.
Here's the script. Save it as 'tovid' and be sure to chmod +x it so you can execute it.
Code:
#!/bin/bash
# Convert any video/audio stream that mplayer can play
# into VCD, SVCD, or DVD-compatible Mpeg output file.
# Arguments: $1 - format: Video CD, Super Video CD, DVD, or VCD-on-DVD [vcd|svcd|dvd]
# $2 - aspect: Widescreen or full-frame [wide|full]
# $3 - name of input file
# $4 - name of output prefix
USAGE="Usage: tovid [vcd|svcd|dvd|dvd-vcd] [wide|full] <input file> <output prefix>"
if [ $# -ne 4 ]; then
echo $USAGE
exit 1
elif [[ $1 == "vcd" || $1 == "dvd-vcd" ]]; then
TGTWIDTH="352"
TGTHEIGHT="240"
PALHEIGHT="288"
FORMAT="VCD"
VIDFMT="-f 1"
# For VCD, use VCD sound profile of mp2enc
if [[ $1 == "vcd" ]]; then
SNDOPTS="-V"
# For VCD-on-DVD, use DVD-format audio
else
SNDOPTS="-r 48000 -s"
fi
MUXOPTS="-m v"
SUF="m1v"
elif [[ $1 == "svcd" ]]; then
TGTWIDTH="480"
TGTHEIGHT="480"
PALHEIGHT="576"
FORMAT="SVCD"
# -d for dummy SVCD scan offsets
VIDFMT="-f 4 -d"
SNDOPTS="-V"
MUXOPTS="-m s"
SUF="m2v"
elif [[ $1 == "dvd" ]]; then
TGTWIDTH="720"
TGTHEIGHT="480"
PALHEIGHT="576"
FORMAT="DVD"
VIDFMT="-f 8"
SNDOPTS="-r 48000 -s"
MUXOPTS="-m d"
SUF="m2v"
else
echo $USAGE
exit 1
fi
if [[ $2 == "wide" ]]; then
ASPECT="WIDE"
elif [[ $2 == "full" ]]; then
ASPECT="FULL"
else
echo "$USAGE"
exit 1
fi
INFILE=$3
OUTPREFIX=$4
# Probe for width, height, and frame rate
tcprobe -i "$INFILE" > fileinfo
CURWIDTH=`grep 'import frame size' fileinfo | \
perl -e ' $line=<STDIN> ; $line =~ /import frame size: -g (\d+?)x\d+ / ; print $1' `
CURHEIGHT=`grep 'import frame size' fileinfo | \
perl -e ' $line=<STDIN> ; $line =~ /import frame size: -g \d+?x(\d+) / ; print $1' `
CURFPS=`grep 'frame rate' fileinfo | \
perl -e ' $line=<STDIN> ; $line =~ /frame rate: -f (.+?) \[/ ; print $1' `
echo "Input file is $CURWIDTH x $CURHEIGHT at $CURFPS fps."
# If FPS is already 29.97 (NTSC) or 23.976 (NTSC film), leave it alone
if [[ $CURFPS == "29.970" ]];
then
echo "Source is 29.970 fps (NTSC). Encoding as NTSC video."
ADJUSTFPS=""
VIDFPS="-F 4"
elif [[ $CURFPS == "23.976" ]];
then
echo "Source is 23.976 fps (NTSC film). Encoding as NTSC film."
ADJUSTFPS="yuvfps -s 24000:1001 -r 30000:1001 -v 0 |"
VIDFPS="-F 4"
else
echo "Source is not at an NTSC frame rate. Adjusting FPS."
ADJUSTFPS="yuvfps -r 30000:1001 -v 0 |"
VIDFPS="-F 4"
fi
# Set appropriate aspect ratio for output format
# Widescreen on DVD should be 16:9
[ $ASPECT == "WIDE" ] && [ $FORMAT == "DVD" ] && ASPECTFMT="-a 3"
# Widescreen on VCD/SVCD needs to be padded out to 4:3
[ $ASPECT == "WIDE" ] && [ $FORMAT != "DVD" ] && ASPECTFMT="-a 2"
# Standard (fullscreen) is always 4:3
[ $ASPECT == "FULL" ] && ASPECTFMT="-a 2"
# Estimate existing aspect ratio (integer math!)
ESTASPECT=$(($CURWIDTH * 100 / $CURHEIGHT))
# Tolerances for wide/full aspect ratio (+/- 10% of target)
if [[ $ASPECT == "WIDE" ]];
then
MINASPECT=160
MAXASPECT=195
else
MINASPECT=120
MAXASPECT=147
fi
# Determine whether any rescaling needs to be done
# If resolution is already the same as the target, do not rescale.
if [[ $CURWIDTH == $TGTWIDTH && $CURHEIGHT == $TGTHEIGHT ]];
then
echo "Source is already at target resolution ($TGTWIDTH x $TGTHEIGHT)."
echo "No rescaling will be applied."
ADJSIZE=""
# See if source is target resolution in PAL
# If so, just rescale; aspect ratio should be fine
elif [[ $CURWIDTH == $TGTWIDTH && $CURHEIGHT == $PALHEIGHT ]];
then
echo "Source appears to be PAL of target resolution ($TGTWIDTH x $PALHEIGHT)."
echo "Assuming correct aspect ratio and rescaling."
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
elif [[ $ESTASPECT -ge $MINASPECT && $ESTASPECT -le $MAXASPECT ]];
then
echo "Source is within 10% of target aspect ratio."
echo "Assuming correct aspect ratio and rescaling."
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
# Otherwise, scale and/or pad with black bars
else
echo "Scaling and/or padding with letterbox bars"
# For non-DVD formats, widescreen needs to be padded to make
# it fullscreen.
[ $FORMAT != "DVD" ] && [ $ASPECT == "WIDE" ] && \
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n -M WIDE2STD |"
# Non-DVD standard sizes can be scaled directly
[ $FORMAT != "DVD" ] && [ $ASPECT == "FULL" ] && \
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
# DVD can be scaled directly
[ $FORMAT == "DVD" ] && \
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
fi
echo "Creating and encoding video stream..."
mkfifo stream.yuv
mplayer -nosound -noframedrop -vo yuv4mpeg -vf pp=hb/vb/dr,hqdn3d "$INFILE" &
eval `echo "cat stream.yuv | $ADJUSTFPS $ADJSIZE nice -n 16 mpeg2enc $ASPECTFMT $VIDFMT $VIDFPS -v 0 -n n -H -o $OUTPREFIX.$SUF"`
echo "Creating WAV of audio stream..."
mplayer -vc dummy -vo null -ao pcm -aofile stream.wav "$INFILE"
# echo "Normalizing WAV audio..."
# normalize --amplitude=-14dBFS stream.wav
echo "Encoding WAV..."
cat stream.wav | mp2enc $SNDOPTS -o "$OUTPREFIX.mpa"
echo "Multiplexing audio and video together..."
tcmplex -i "$OUTPREFIX.$SUF" -p "$OUTPREFIX.mpa" -o "$OUTPREFIX.mpg" $MUXOPTS
echo "Cleaning up..."
rm stream.yuv
rm stream.wav
# rm "$OUTPREFIX.$SUF"
# rm "$OUTPREFIX.mpa"
rm fileinfo
echo "Done"
To run the script, provide it with four arguments:
The format you want to encode to (dvd, vcd, svcd, or dvd-vcd)
The aspect ratio you want to use (widescreen or full-frame)
The filename of the video you want to encode, e.g. Office_Space.avi
The filename prefix of the output file you want., e.g. Office_Space_DVD
The widescreen or full-frame part is a little tricky, but really all you need to consider is whether the source video looks like it's in widescreen or in normal full-frame TV-style aspect ratio. That is, when you play the video, should it fill the screen, or should it have the black letterbox bars?
Caveat: This script only outputs NTSC format. If you are planning to play your video discs on a PAL-format television or something, this script will not help you (though you may be able to rewrite portions of it to make it do PAL).
I make no guarantees about this script. It probably still has some bugs, but you may find it useful.
Hi wapcaplet,
Thanks for the great article. I'd like to ask one small question.
I've used the SVCD version of the script (divx2svcd) to convert one DivX 5.1 file to the corresponding SVCD image, but got very irritating results.
First of all, the AVI length is something about 87000 frames (52 min.) and is 704 MB big. I got a dozen of files with sizes from 200 bytes to 900 MB big.
This is what I found in the folder containing the AVI file and the subtitle one.
The original files
the AVI file itself: MyDivXFilm.avi
the SUB file: MyDivXFilm.srt
The transcoded files
some file named MyDivXFilm.m2v and 720MB big
some file named MyDivXFilm.mpa and 67 MB big
some file named Pelicula.mpg and 900MB big
some file named Pelicula00.mpg and 712MB big
some file named Pelicula00.mpg.bin and 711MB big
some file named Pelicula00.mpg.cue and 178 Bytes big
some file named Pelicula01.mpg and 89MB big
some file named Pelicula01.mpg.bin and 87MB big
some file named Pelicula01.mpg.cue and 178 Bytes big
So, what is supposed to be done with these bunch of big&mighty files? And how comes it that I got the Film split in two parts?
One furter question: May I use a DVD media to write a (S)VCD where all parts of the film are in one place?
Many thanks in advance.
Kind regards,
sbogus
by wapcaplet on Sat, 2004-06-26 23:13
It looks like you are using divx2svcd. I cannot answer for that script, since I did not write it In fact, I've never been able to get anything useful out of it myself; I just borrowed some segments of it for mine.
Though, I did realize after posting my script that there is one small mistake: there are two lines towards the end, under "Cleaning up..." that read:
Code:
# rm "$OUTPREFIX.$SUF"
# rm "$OUTPREFIX.mpa"
Uncomment them by removing the leading hash mark. Those are the reason you are left with an extra 'mpa' and 'm2v' file after encoding. With my script, you should end up with is a new file with an .mpg extension, and nothing else. The size is somewhat out of your control, with the current version, however. I'll see about introducing a bit-rate option for SVCD. 704MB sounds reasonable for 52 minutes of video.
I've made a lot of changes to my script since I posted this... I'll have to see about revising the posted version.
by wapcaplet on Sat, 2004-06-26 23:26
Here is a revised version of my script. Additions and alterations include:
New 'panavision' aspect ratio option. Some movies are in an aspect ratio of about 2.35:1 (which is quite a bit wider than the 16:9 ratio). If you have such a video, use the 'panavision' command-line option, rather than 'widescreen'. Easy way to find out: divide the width by the height (in pixels). If it's close to 2.35, you have 'panavision'. If it's closer to 1.85, you have 'widescreen'. If you use the wrong one for your video, the picture may look squished/stretched.
New 'half-dvd' output format. DVD supports a 'half' resolution of 352x480, which is suitable for TV shows or other stuff you may have that 720x480 would be overkill for.
Bitrate options. You can hard-code bitrates into the lines at the beginning for both DVD and half-DVD. I've found the given values to be fairly good.
Removed dependencies on transcode and perl. Good because I found some source video that transcode's 'tcprobe' choked on. mencoder used for all video identification now.
Todo:
Bitrate option for SVCD
Better aspect ratio guessing (works for some, but not others, e.g. panavision)
Better system for audio normalization. Works for some, distorts others. (normalization is still commented out, but uncomment the 'normalize...' line if you need it)
Here it is. Enjoy!
Code:
#!/bin/bash
# Convert any video/audio stream that mplayer can play
# into VCD, SVCD, or DVD-compatible Mpeg output file.
# Arguments: $1 - format: Video CD, Super Video CD, DVD, or VCD-on-DVD [vcd|svcd|dvd]
# $2 - aspect: Widescreen or full-frame [wide|full]
# $3 - name of input file
# $4 - name of output prefix
# Some constants to use:
# Maximum bitrates (for video):
# kbps guaranteed possible notes
# ----------------------------------------------------
# 7500 81 min. 270 min. Good for full DVD
# 3000 194 min. 400 min. Good for half-D1
DVD_BITRATE="7500"
# Bitrate to use for Half-D1-encoded DVD format. Since resolution of Half-D1 is
# a little less than half that of full DVD, bitrate can be half as much here with
# quality (per pixel) comparable to full DVD.
HALF_D1_BITRATE="3600"
QUARTER_D1_BITRATE=$(($HALF_D1_BITRATE / 2))
USAGE="Usage: tovid [vcd|svcd|dvd|half-dvd|dvd-vcd] [wide|full|panavision] <input file> <output prefix>"
if [ $# -ne 4 ]; then
echo $USAGE
exit 1
elif [[ $1 == "vcd" || $1 == "dvd-vcd" ]]; then
TGTWIDTH="352"
TGTHEIGHT="240"
PALHEIGHT="288"
# For VCD, use VCD sound profile of mp2enc
if [[ $1 == "vcd" ]]; then
FORMAT="VCD"
VIDFMT="-f 1"
SNDOPTS="-V"
MUXOPTS="-m v"
SUF="m1v"
# For VCD-on-DVD, use DVD-format audio
else
FORMAT="SIZE_352x240"
VIDFMT="-f 8 -b $QUARTER_D1_BITRATE"
SNDOPTS="-r 48000 -s"
MUXOPTS="-m d"
SUF="m2v"
fi
elif [[ $1 == "svcd" ]]; then
TGTWIDTH="480"
TGTHEIGHT="480"
PALHEIGHT="576"
FORMAT="SVCD"
# -d for dummy SVCD scan offsets
VIDFMT="-f 4 -d"
SNDOPTS="-V"
MUXOPTS="-m s"
SUF="m2v"
elif [[ $1 == "dvd" ]]; then
TGTWIDTH="720"
TGTHEIGHT="480"
PALHEIGHT="576"
FORMAT="DVD"
VIDFMT="-f 8 -b $DVD_BITRATE"
SNDOPTS="-r 48000 -s"
MUXOPTS="-m d"
SUF="m2v"
elif [[ $1 == "half-dvd" ]]; then
TGTWIDTH="352"
TGTHEIGHT="480"
PALHEIGHT="576"
FORMAT="SIZE_352x480"
VIDFMT="-f 8 -b $HALF_D1_BITRATE"
SNDOPTS="-r 48000 -s"
MUXOPTS="-m d"
SUF="m2v"
else
echo $USAGE
exit 1
fi
if [[ $2 == "wide" ]]; then
ASPECT="WIDE"
elif [[ $2 == "full" ]]; then
ASPECT="FULL"
elif [[ $2 == "panavision" ]]; then
ASPECT="PANA"
else
echo "$USAGE"
exit 1
fi
INFILE=$3
OUTPREFIX=$4
# Filtering options to use with mplayer
# pp=hb/vb/dr gives horizontal and vertical deblocking, plus deringing
# hqdn3d gives high quality denoising
VIDFILTER="-vf pp=hb/vb/dr,hqdn3d"
# VIDFILTER="-vf hqdn3d"
# Probe for width, height, and frame rate
mplayer -vo null -ao null -frames 0 -identify "$INFILE" 2>/dev/null | \
grep "^ID_" > fileinfo
CURWIDTH=`grep 'ID_VIDEO_WIDTH' fileinfo | \
sed -e 's/ID_VIDEO_WIDTH=//g'`
CURHEIGHT=`grep 'ID_VIDEO_HEIGHT' fileinfo | \
sed -e 's/ID_VIDEO_HEIGHT=//g'`
CURFPS=`grep 'ID_VIDEO_FPS' fileinfo | \
sed -e 's/ID_VIDEO_FPS=//g'`
echo "Input file is $CURWIDTH x $CURHEIGHT at $CURFPS fps."
# If FPS is already 29.97 (NTSC) or 23.976 (NTSC film), leave it alone
if [[ $CURFPS == "29.970" ]];
then
echo "Source is 29.970 fps (NTSC). Encoding as NTSC video at 29.97 FPS."
ADJUSTFPS=""
VIDFPS="-F 4"
elif [[ $CURFPS == "23.976" ]];
then
echo "Source is 23.976 fps (NTSC film). Adjusting FPS to 29.97."
ADJUSTFPS="yuvfps -s 24000:1001 -r 30000:1001 -v 0 |"
VIDFPS="-F 4"
else
echo "Source is not at an NTSC frame rate. Adjusting FPS to 29.97."
ADJUSTFPS="yuvfps -r 30000:1001 -v 0 |"
VIDFPS="-F 4"
fi
# Set appropriate aspect ratio for output format
# Widescreen on DVD should be 16:9
[ $ASPECT == "WIDE" ] && [ $FORMAT == "DVD" ] && ASPECTFMT="-a 3"
# Panavision on DVD is encoded at 16:9 with letterboxing added
[ $ASPECT == "PANA" ] && [ $FORMAT == "DVD" ] && ASPECTFMT="-a 3"
# Widescreen on VCD/SVCD needs to be padded out to 4:3
[ $ASPECT == "WIDE" ] && [ $FORMAT != "DVD" ] && ASPECTFMT="-a 2"
# Standard (fullscreen) is always 4:3
[ $ASPECT == "FULL" ] && ASPECTFMT="-a 2"
# Estimate existing aspect ratio (integer math!)
ESTASPECT=$(($CURWIDTH * 100 / $CURHEIGHT))
# Tolerances for wide/full aspect ratio (+/- 10% of target)
if [[ $ASPECT == "WIDE" ]];
then
MINASPECT=160
MAXASPECT=195
else
MINASPECT=120
MAXASPECT=147
fi
# Determine whether any rescaling needs to be done
# If resolution is already the same as the target, do not rescale.
if [[ $CURWIDTH == $TGTWIDTH && $CURHEIGHT == $TGTHEIGHT ]];
then
echo "Source is already at target resolution ($TGTWIDTH x $TGTHEIGHT)."
echo "No rescaling will be applied."
ADJSIZE=""
# See if source is target resolution in PAL
# If so, just rescale; aspect ratio should be fine
elif [[ $CURWIDTH == $TGTWIDTH && $CURHEIGHT == $PALHEIGHT ]];
then
echo "Source appears to be PAL of target resolution ($TGTWIDTH x $PALHEIGHT)."
echo "Assuming correct aspect ratio and rescaling."
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
elif [[ $ESTASPECT -ge $MINASPECT && $ESTASPECT -le $MAXASPECT ]];
then
echo "Source is within 10% of target aspect ratio."
echo "Assuming correct aspect ratio and rescaling."
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
# Otherwise, scale and/or pad with black bars
else
echo "Scaling and/or padding with letterbox bars"
# For non-DVD formats, widescreen needs to be padded to make
# it fullscreen.
if [ $FORMAT != "DVD" ] && [ $ASPECT == "WIDE" ]; then
echo "Letterboxing widescreen aspect to fit in 4:3 aspect"
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n -M WIDE2STD |"
# Non-DVD standard sizes can be scaled directly
elif [ $FORMAT != "DVD" ] && [ $ASPECT == "FULL" ]; then
echo "Scaling full-screen aspect"
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
# Non-panavision DVD can be scaled directly
elif [ $ASPECT != "PANA" ] && [ $FORMAT == "DVD" ]; then
"Scaling directly to DVD resolution"
ADJSIZE="yuvscaler -O $FORMAT -v 0 -n n |"
# Panavision (2.35:1) DVD must be padded within the 16:9 frame
elif [ $ASPECT == "PANA" ] && [ $FORMAT == "DVD" ]; then
echo "Letterboxing Panavision (2.35:1) aspect to fit DVD widescreen aspect"
ADJSIZE="yuvscaler -O DVD -v 0 -n n |"
VIDFILTER=`echo $VIDFILTER,scale=720:363,expand=720:480`
fi
fi
echo "Creating and encoding video stream..."
mkfifo stream.yuv
mplayer -nosound -noframedrop -vo yuv4mpeg $VIDFILTER "$INFILE" &
eval `echo "cat stream.yuv | $ADJUSTFPS $ADJSIZE nice -n 16 mpeg2enc $ASPECTFMT $VIDFMT $VIDFPS -v 0 -n n -H -o $OUTPREFIX.$SUF"`
echo "Creating WAV of audio stream..."
mplayer -vc dummy -vo null -ao pcm -aofile stream.wav "$INFILE"
# echo "Normalizing WAV audio..."
# normalize --amplitude=-14dBFS stream.wav
echo "Encoding WAV..."
cat stream.wav | mp2enc $SNDOPTS -o "$OUTPREFIX.mpa"
echo "Multiplexing audio and video together..."
tcmplex -i "$OUTPREFIX.$SUF" -p "$OUTPREFIX.mpa" -o "$OUTPREFIX.mpg" $MUXOPTS
echo "Cleaning up..."
rm stream.yuv
rm stream.wav
rm "$OUTPREFIX.$SUF"
rm "$OUTPREFIX.mpa"
rm fileinfo
echo "Done"
by wapcaplet on Tue, 2004-07-06 14:28
Rather than continue to clutter the forum with updates to this script, I thought I'd just direct your attention to the tovid homepage and tovid project summary page on Sourceforge. Patches and updates are welcome!
by sbogus on Thu, 2004-07-08 02:13
Quote:
Originally posted by wapcaplet Rather than continue to clutter the forum with updates to this script, I thought I'd just direct your attention to the tovid homepage and tovid project summary page on Sourceforge. Patches and updates are welcome!
Great!
But the homesite and the download section does not work - I can't download the 0.1 version of the script&GUI. Am I doing smoething wrong or because the project is very new to SF, there's not yet mirrored files to download?
Kind regards,
sbogus
by wapcaplet on Thu, 2004-07-08 04:56
Quote:
Originally posted by sbogus But the homesite and the download section does not work - I can't download the 0.1 version of the script&GUI.
Dunno. Works OK for me! Could be a mirror problem, I suppose. Try again in a couple days.
by sbogus on Thu, 2004-07-08 05:57
Okay, thanks wapcaplet,
now it worked with the download.
What version of mplayer do you use with the script? Because mine is 1.0.pre4[whatever] and keeps instantly crashing when the script tries to extract the audio from the AVI file. The file itself plays perfect in the player but extracting the audio does not work.
I've also played with the options, but could not manage to tell mplayer to extract the audio only using other options than the ones you've used in the script. But then again, it crashes with these options...
Thanks in advance.
Kind regards,
sbogus
by wapcaplet on Thu, 2004-07-08 15:51
My mplayer version is 1.0pre4-3.3.2. What error message do you get when it crashes? If it's just a segfault, I wouldn't know where to begin fixing it Does it crash with all video files, or just a specific format? AVI video can have a variety of different audio codecs along with it. If it's just a specific format, or a specific video file, you can find out the audio format by running:
Code:
mplayer -identify YourVideoFile
Look for the line that says "ID_AUDIO_CODEC" and also the line "ID_AUDIO_FORMAT". Let me know what they are.
by sbogus on Fri, 2004-07-09 04:32
Thanks wapcaplet,
it segfaults (crashed with signal 11).
It crashes on each AVI file that has MP3 audio therein (XViD, DivX 5.x)) and unfortunately all my films&videos are either in XViD or in DivX 5.x format.
The MP3 audio stream is always in 44100 Hz frequency, the codec that is used to play the stream is "lame", but sometimes it uses also "MAD" for the playing. I don't know why...
Thanks for helping me continuously.
Kind regards,
sbogus
by wapcaplet on Fri, 2004-07-09 20:05
OK, until I figure out a different way to extract .wav from mplayer, try changing the line in the script:
(just remove the -vc dummy part - I'm not too sure about it anyway). If you want to just test it out without modifying the script, just run the above command manually, replacing $INFILE with the name of your AVI (you can leave out the quotes). Let me know if that works.
Since I am unable to get any of my AVIs to cause crashing, I'd like to use you as a guinea-pig for another little experiment, if you don't mind. Try this command:
Code:
mplayer -dumpaudio -dumpfile stream YourAVIFile
From what I can determine, this will just bulk-copy the audio portion to a separate file (called 'stream'). That file should be whatever format the audio itself was in (an mp3, in your case). To find out for sure, run this command:
Code:
file stream
If that works, then I am hoping you have sox installed, because it can convert a bunch of different formats. If you do, try this command (assuming it's mp3):
Code:
sox -t mp3 stream stream.wav
It might complain about not supporting 16-bit data, but it ought to do the conversion. If all of that works for you, then it may give me another option to work with for extracting the .wav output. (You can play the wav with 'play stream.wav', to make sure it sounds like your video.) Too bad sox can't convert directly to mp2 audio, since that's what it eventually needs to be! If any of the above doesn't work, let me know what part and what errors you get.
Another thing to try, if you haven't already, is upgrading mplayer and/or lame. Could just be a bug with one of those.
Thanks for all your feedback so far! You're my first beta-tester
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
Thanks for the great article. I'd like to ask one small question.
I've used the SVCD version of the script (divx2svcd) to convert one DivX 5.1 file to the corresponding SVCD image, but got very irritating results.
First of all, the AVI length is something about 87000 frames (52 min.) and is 704 MB big. I got a dozen of files with sizes from 200 bytes to 900 MB big.
This is what I found in the folder containing the AVI file and the subtitle one.
The original files
the AVI file itself: MyDivXFilm.avi
the SUB file: MyDivXFilm.srt
The transcoded files
some file named MyDivXFilm.m2v and 720MB big
some file named MyDivXFilm.mpa and 67 MB big
some file named Pelicula.mpg and 900MB big
some file named Pelicula00.mpg and 712MB big
some file named Pelicula00.mpg.bin and 711MB big
some file named Pelicula00.mpg.cue and 178 Bytes big
some file named Pelicula01.mpg and 89MB big
some file named Pelicula01.mpg.bin and 87MB big
some file named Pelicula01.mpg.cue and 178 Bytes big
So, what is supposed to be done with these bunch of big&mighty files? And how comes it that I got the Film split in two parts?
One furter question: May I use a DVD media to write a (S)VCD where all parts of the film are in one place?
Many thanks in advance.
Kind regards,
sbogus
Though, I did realize after posting my script that there is one small mistake: there are two lines towards the end, under "Cleaning up..." that read:
I've made a lot of changes to my script since I posted this... I'll have to see about revising the posted version.
Todo:
Here it is. Enjoy!
Rather than continue to clutter the forum with updates to this script, I thought I'd just direct your attention to the tovid homepage and tovid project summary page on Sourceforge. Patches and updates are welcome!
But the homesite and the download section does not work - I can't download the 0.1 version of the script&GUI. Am I doing smoething wrong or because the project is very new to SF, there's not yet mirrored files to download?
Kind regards,
sbogus
But the homesite and the download section does not work - I can't download the 0.1 version of the script&GUI.
now it worked with the download.
What version of mplayer do you use with the script? Because mine is 1.0.pre4[whatever] and keeps instantly crashing when the script tries to extract the audio from the AVI file. The file itself plays perfect in the player but extracting the audio does not work.
I've also played with the options, but could not manage to tell mplayer to extract the audio only using other options than the ones you've used in the script. But then again, it crashes with these options...
Thanks in advance.
Kind regards,
sbogus
it segfaults (crashed with signal 11).
It crashes on each AVI file that has MP3 audio therein (XViD, DivX 5.x)) and unfortunately all my films&videos are either in XViD or in DivX 5.x format.
The MP3 audio stream is always in 44100 Hz frequency, the codec that is used to play the stream is "lame", but sometimes it uses also "MAD" for the playing. I don't know why...
Thanks for helping me continuously.
Kind regards,
sbogus
Since I am unable to get any of my AVIs to cause crashing, I'd like to use you as a guinea-pig for another little experiment, if you don't mind. Try this command:
Another thing to try, if you haven't already, is upgrading mplayer and/or lame. Could just be a bug with one of those.
Thanks for all your feedback so far! You're my first beta-tester