avconv: convert m4v to avi, but not Avidemux
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 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! Steve |
Quote:
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: For the first pass, send the output to dev/null: Code:
$ ffmpeg -i blah.m4v -c:v libxvid -c:a libmp3lame -r 30 -threads 12 -pass 1 -f rawvideo -y /dev/null Use this file to help with the second pass: Code:
$ ffmpeg -i blah.m4v -c:v libxvid -c:a libmp3lame -r 30 -ar 44100 -b:a 128k -qscale 1 -threads 12 -pass 2 -passlogfile ffmpeg2pass foo.avi A lot more about ffmpeg can be read on my site: http://slackermedia.ml/handbook/doku.php?id=ffmpeg |
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.
Thanks again. Steve |
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?
|
Quote:
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. :(
Edit: https://en.wikipedia.org/wiki/MPEG-4#MPEG-4_Parts Edit 2: How about retiring this player and replacing it with RPi running OpenElec. |
Quote:
DVD standard is mpeg2 video and aac or uncompressed audio. Same as atsc tv signals. Quote:
I don't think that you have said what the audio and video of the original is. Code:
ffprobe myfile.m4v Code:
ffmpeg -i myfile.m4v -c:a copy -c:v mpeg2video -b:v 2500k output.avi Code:
ffprobe output.avi I would say that would be your best bet. Make the video conform to DVD standard. |
Quote:
|
I've seen a DVD from a service that ends with flix that had wave audio. I've seen ac3 on DVD's. If you need ac3 audio then:
Code:
ffmpeg -i myfile.m4v -c:a ac3 -b:a 128k -c:v mpeg2video -b:v 2500k output.avi I tried that example and it workid fine. Code:
ffprobe output.avi Code:
azap -r -c $HOME/.mplayer/channels.conf WABC |
Thank you to everyone for your advice. Think I'll stick with Avidemux for the best overall result then.
Steve |
All times are GMT -5. The time now is 06:14 PM. |