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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-24-2012, 08:39 AM
|
#1
|
|
Member
Registered: Mar 2007
Distribution: Ubuntu 12.04, Mint 12 LXDE
Posts: 384
Rep:
|
flv to avi converter - syncing problems
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?
Last edited by Steve W; 06-24-2012 at 08:41 AM.
|
|
|
|
06-24-2012, 11:41 AM
|
#2
|
|
Senior Member
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,717
Rep: 
|
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>
|
|
|
|
06-25-2012, 03:13 AM
|
#3
|
|
Member
Registered: Mar 2007
Distribution: Ubuntu 12.04, Mint 12 LXDE
Posts: 384
Original Poster
Rep:
|
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?
|
|
|
|
06-25-2012, 03:53 AM
|
#4
|
|
Member
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 597
Rep: 
|
Quote:
Originally Posted by Steve W
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.
|
|
|
|
06-25-2012, 04:10 AM
|
#5
|
|
Member
Registered: Mar 2007
Distribution: Ubuntu 12.04, Mint 12 LXDE
Posts: 384
Original Poster
Rep:
|
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.
Thank you for your patience.
|
|
|
|
06-25-2012, 07:41 AM
|
#6
|
|
Member
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 597
Rep: 
|
Quote:
Originally Posted by Steve W
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.
|
|
|
|
06-26-2012, 04:47 AM
|
#8
|
|
Member
Registered: Mar 2007
Distribution: Ubuntu 12.04, Mint 12 LXDE
Posts: 384
Original Poster
Rep:
|
Okay, I'll give both of those a go. Thanks.
|
|
|
|
06-26-2012, 12:58 PM
|
#9
|
|
Member
Registered: Mar 2007
Distribution: Ubuntu 12.04, Mint 12 LXDE
Posts: 384
Original Poster
Rep:
|
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....
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:16 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|