ffmpeg mass convert & merge video files from various formats
Hi all! I am pretty sure this wont be a tough one for the real ffmpeg Gurus but I have achieved minor success so far in converting videos with ffmpeg.
Basically, I have a folder with all kind of video files (.flv, .wmv, .mpeg .mp4...) you got the idea.. These files all have different resolutions (some are 640x480, others are 320x240, etc..) and I also assume they also have all kind of different codecs, etc.. I take that some were encoded in windows, some in Mac, some in Linux and with all kind of methods, applications etc.. In other words, its a mess. I'd like to mass (batch) convert all files to the exact same format (container, resolution, codecs, etc) for later on merge (concatenate) all of them into a single file. A script would be nice. I'd dump all files in a folder, run the script and bingo, I get a big file and Im done. So far I have used this command within the folder where all files are stored: Quote:
I am pretty sure that there must be a script someone already worked on. I couldnt find anything like that.. Right now I am in some kind of a rush so I am looking for a quick fix instead of learning ffmpeg.. If someone can point me to something I'd be very grateful, otherwise I will keep searching and trying. Thanks! |
I *may* have found something. Trying as we "speak".... Ill post the results when done, but I am confident it will work. If so, KUDOS to the original writer!
To be continued ! |
something like this mite work:
Code:
/usr/bin/mencoder *.* -o /dev/null -vc mpeg12 -vf pp=al:c,softskip,unsharp=l5x5:.25:c5x5:.25,harddup -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=192 -a52drc 1 -ovc xvid -xvidencopts pass=1:turbo:me_quality=6:vhq=4:threads=2:max_bframes=2:bvhq=1:nopacked:quant_type=h263:noqpel:nogmc:trellis:nointerlacing:chroma_me:chroma_opt:hq_ac:nolumi_mask:rc_reaction_delay_factor=0:rc_averaging_period=100:closed_gop:autoaspect -passlogfile out.log |
Wow these are LONNNNNG commands!! No chance I would have ever been able to formulate those..
The first command throws Code:
-xvidencopts is not an MEncoder option Can you modify these commands? Better, are you aware of some kind of wizard that could help me build such a command without spending countless hours trying different options until it works..? |
Quote:
Code:
xbmc@XBMCLive:~$ mencoder -ovc help Quote:
|
You were right. My machine did not have xvid as a codec. However, I have tried on a different machine that has everything installed, the command (the first one you provided) starts well but after several minutes (10 or so..) it throws away:
Code:
========================================================================== |
Could you please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.
And please edit your previous posts so that it doesn't make the window side-scroll. Thanks! Speaking of which, the command in the OP has a few weaknesses. I'm going to start by breaking it into a multi-line format, for readability: Code:
$IFS=$'\n' 1) The first problem is Don't Read Lines With For! While setting IFS to newline does work to avoid the main problem with it, it's more of a cludgy work-around than a true fix. 2) Useless Use of ls *. It does absolutely nothing here except waste an extra process. Both 1 and 2 can be replaced more safely with a simple globbing pattern. 3) QUOTE ALL OF YOUR VARIABLE EXPANSIONS. You should never leave the quotes off a parameter expansion unless you explicitly want the resulting string to be word-split by the shell (globbing patterns are also expanded). This is a vitally important concept in scripting, so train yourself to do it correctly now. You can learn about the exceptions later. http://mywiki.wooledge.org/Arguments http://mywiki.wooledge.org/WordSplitting http://mywiki.wooledge.org/Quotes Again, just like in #1, re-setting IFS works around it, but it's safer to just do it correctly. 4) While not actually a mistake, basename can be replaced with a simple parameter substitution. There's also a kind of unusual and unnecessary code flow in the above, removing the extension globally, then re-adding it. 5) Since environment variables are generally all upper-case, it's good practice to keep your own user variables in lower-case or mixed-case to help differentiate them. You should also generally try to use variable names that clearly relate to their function in the script (but that don't conflict with existing command names, like "file"). Thus the corrected version should more properly look more like this: Code:
for fname in *.wmv; do |
Quote:
maybe ffmpeg would be more efficient. |
All times are GMT -5. The time now is 07:14 PM. |