[SOLVED] avconv: convert m4v to avi, but not Avidemux
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.
If I need to convert an m4v file to avi, I can use Avidemux but it takes a while - about 20-25 mins for a 30 min video on my PC.
I thought I had found a faster method - the shell utility "avconv". However, the files convert faster (takes about 10 mins for a 30 min video), but either the files are 2-3 times as big as the avi's Avidemux produces, or the output is of a lesser quality, depending on the switches I use. It pelts along at around 100-150 frames per second conversion, as opposed to Avidemux's rate of 48-58 fps conversion rate, but with an unsatisfactory result.
I'm sure I'm using the avconv switches wrongly somewhere.
The Avidemux output while converting confirms that the "Quantiser" equals 4; the average bitrate is 800 kb/s. Frames per second conversion rate is around 48 to 58 on average.
By contrast, the avconv script I'm using says:
Code:
for i in *.m4v; do
avconv -i "$i" -c:v mpeg4 -vtag xvid -c:a libmp3lame -r 30 -b:v 800k "${i%.*}".avi
done
Using this script, the file is an acceptable size, but image frame quality is less. If I use -b:v 1800k or possibly -qscale 4, quality is better but file size shoots up. (I assume qscale is equivalent to Avidemux's quantiser reading).
Also for some reason, while avconv is working away, it states a video bitrate way above the 800k I specify. I am aware that qscale maintains a standard quality regardless of bitrate; but should I be using -b:v to set the bitrate, or qscale to keep the image quality constant?
And what is Avidemux doing that is slower, produces smaller file sizes but still maintains quality?
I did read that Avidemux uses ffmpeg "underneath the hood". But I thought avconv had superseded ffmpeg now. Should I be running a similar script, but using ffmpeg instead of avconv?
Thank you for any help you can give. If I can get avconv producing identical output quality to Avidemux, but 3 times faster, that would be the ideal solution. I could understand avconv producing lower quality output, but faster; but it still only takes 10 mins to produce identical quality output to Avidemux - but with 3 times the file size!
I can use Avidemux but it takes a while - about 20-25 mins for a 30 min video on my PC.
I thought I had found a faster method - the shell utility "avconv". However, the files convert faster (takes about 10 mins for a 30 min video), but either the files are 2-3 times as big as the avi's Avidemux produces, or the output is of a lesser quality, depending on the switches I use.
and that is how it is.
quick conversion = either low quality or huge files
slow conversion = possible to find good balance between quality and filesize.
if you find the right settings for avconv, it will take about as long as with avidemux, i guess. but try by all means, maybe you can shave off some seconds or megabytes.
Avconv "superseded" ffmpeg only according to avconv, and for a while, Debian (although, thankfully, they seem to be backing away from symlinking ffmpeg to avconv as if ffmpeg no longer exists). FFmpeg is still very much alive, still very active, and very relevant.
You probably do want a variable bitrate (VBR). This allows your video converter (ffmpeg or a fork like avconv) to "spend" more bits on complex motion and fewer bits on slow, non-moving (or low motion) shots. `-qscale` is the option for that.
You will also benefit from using the 2-pass option; the first pass allows ffmpeg (or avconv) to calculate bitrates and then the second pass performs the actual encode:
Okay, thanks for the advice. I might stick with Avidemux then, if it's a swings-and-roundabouts situation. I also notice, when I do "avconv -i [filename]" to get info on a file, the ones from Avidemux use Advanced Simple Profile, but avconv output uses just "Simple Profile". Maybe that also has something to do with it.
You are actually converting H.264 to Xvid. I wonder if there is a simpler solution. Why you need to use AVI container? Will simply remuxing existing video and audio into AVI container work for you?
Why you need to use AVI container? Will simply remuxing existing video and audio into AVI container work for you?
Well, how does that actually work, either in Avidemux or avconv/ffmpeg? Are you saying that in Avidemux I could just change the "Container" dropdown near the bottom of the screen to AVI, leave the other options to just "Copy" and that would work?
I'm trying to make the videos compatible with my DVD player, which has a USB port on the front to play content on a memory stick, but is fussy and does not want to play MP4 or MKV files, only DIVX or XVID files with an AVI extension.
Doing "ffmpeg -i old_video.mp4 -vcodec copy -acodec copy new_video.avi" does not work; it doesn't even preserve audio when I play it back in VLC on my PC!
Neither does using Avidemux as described in my first paragraph above. I cannot see how merely changing the container is going to fool my DVD player into playing a codec it isn't programmed to understand.
Am I doing something wrong? Is it possible your "quick method" you describe could ever work for me?
I was just wondering. H.264 is MPEG-4 Part 10 coder, while Xvid is MPEG-4 Part 2 codec. They both are MPEG-4, although I'm not sure if AVI container can even handle H.264. It seems your hardware player cannot play it, either. Unfortunately, this means you need to re-code.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.