Linux - SoftwareThis 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
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.
For a while now I have been using a script I found to convert flv files (such as downloaded from YouTube) to avi. The script I use is:
Code:
#!/bin/sh
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 -vf harddup \
vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoaspect"
;;
-xvid)
MENC_OPTS="-ovc xvid -vf harddup -xvidencopts bitrate=$V_BITRATE:autoaspect"
;;
*)
if file "$1" | grep -q "Macromedia Flash Video"; then
mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame -vf harddup \
-lameopts fast:preset=standard -o \
"`basename $1 .flv`.avi"
else
echo "$1 is not Flash Video. Skipping"
fi
;;
esac
shift
done
Initially, I had a problem with some files losing sync between video and audio. So people's lips didn't always keep track with what they were saying. So after Googling the problem, I added the -vf harddup option to the mencoder line - it wasn't there before.
Apparently the problem can be caused by mencoder dropping frames occasionally. Option harddup is meant to stop this from happening.
Except I still get sync problems even with this amended script. Can anyone with a knowledge of mencoder see why? Should I put the -vf option in a different place within the command line, or would anywhere do? Is there anything else I can try, to preserve synchronicity while converting from flv to avi?
download with youtube-dl with all fancy options (prefer webm)
If flv, then convert with ffmpeg
<code>
for I in *.flv; do ffmpeg -i "$I" -sameq "${I%.flv}.avi"; done
</code>
Thanks, but your line does not encode to xvid, which is the only format that will play on my DVD player (it has a USB port in the front to play videos from a memory stick, but formats it will play are limited).
I tried to add an xvid option to your line, but it did not work:
for I in *.flv; do ffmpeg -i "$I" -vcodec xvid -sameq "${I%.flv}.avi"; done
It says "Unknown encoder - xvid", despite me getting the option from a webpage of ffmpeg options! Is there something I need to download to add to the standard ffmpeg package to give it xvid conversion capabilities, or can you suggest another ffmpeg argument that would convert to xvid?
It says "Unknown encoder - xvid", despite me getting the option from a webpage of ffmpeg options! Is there something I need to download to add to the standard ffmpeg package to give it xvid conversion capabilities, or can you suggest another ffmpeg argument that would convert to xvid?
It depends on how your ffmpeg version has been compiled from source, as you need to specify a configure-time option to compile-in support to the xvidcore library.
I've never compiled anything from source. I'm one of those who download everything from the Ubuntu Software Centre.
So, if ffmpeg's not gonna work for me then - anyone got any other suggestions (maybe using mencoder or Avidemux)? The option on YouTube Downloader for converting seems to downgrade the quality of the video sound (from 44K to 22K) and there are no options in that program to change this. So I can't use that.
I've never compiled anything from source. I'm one of those who download everything from the Ubuntu Software Centre.
So, if ffmpeg's not gonna work for me then - anyone got any other suggestions (maybe using mencoder or Avidemux)?
Do not give up so easily. Turns out that ffmpeg expects libxvid instead of xvid as a vcodec option, so you should be able to use it.
Take note, however, that you'll probably need to tweak video encoding options.
I should point out, that when I use the script above (the longer one with Mencoder), the output constantly reports "Skipping frame" at numerous intervals while converting. I don't know whether the softskip or harddup options are meant to either stop that from happening, or negate its influence - but I wondered whether all that frame skipping is the reason the AV gets out of sync....
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.