PDA

View Full Version : Command line woes


jdlk
4th March 2007, 19:20
I recently decided I had to get organised about encoding all my recordings, and the only way I'm ever going to do that is with an automated process using command line scripts.

I started by using DIVX via the Dr. Divx command line (cli.exe) and that does what it says on the tin. The heart of my script is a simple one line command:

for %%i in (*.mpg) do "C:\Program Files\blah\cli.exe" -i "%%~dpi%%i" -o "%%~dpi%%~ni.avi" -x profile.xml(where -x calls a profile saved in the Dr Divx GUI)

About the same time I started testing Xvid, and came to the conclusion that, for my eyes and equipment (I'm being careful here), Xvid offers better quality per byte than Divx.

So I started investigating Xvid command line options. Maybe it's just me, but...three frustrating evenings later, I've tried the following:

FFMPEG: works fine, but produces files that won't play on my media server no matter what commands I use (they do play on my PC). Another thread (http://forum.doom9.org/showthread.php?t=120904) suggests that it is a problem with bad headers, and using the tests in that thread confirmed this. Different builds didn't help, but using the same builds through various GUIs with the same settings produced compliant encodes. Strange.

Mencoder: Using two-pass I consistently had an "oversize" problem, and no amount of changing commandline options (using the advice in this forum), or builds, would solve it. One-pass CQ does work, though.

Encraw: this may just be me being stupid, but I couldn't find a way in encraw to deal with audio - it appeared to offer video output only. I'm looking for a one-shot program.

Staxrip: works well via the command line, but throws out error messages all the time. Although it's encoding properly, the error messages freeze Staxrip eventually, and make it unsuitable for batches. There doesn't seem to be a "suppress errors" option.

So from the four most suggested command line options in this forum, I can only get Mencoder working properly, and then only with one pass.

I'd love to know if any of you who have gone along the same path have found a better option, or have had more success with the above programs. For now, I'm back, semi-reluctantly, to Dr Divx.

ilovejedd
5th March 2007, 00:56
Question, what're you using for your Media Server? What player did you use to test videos on your PC? Also, regarding ffmpeg, can you open the output file with VirtualDub? For some reason, the fourcc code ffmpeg uses is 'xvid' and I always have to run the output files via Nic's FourCC changer to change code to 'XVID' for the files to be readable in VirtualDub, etc. Should the problem be bad headers, you can easily run the converted AVIs via VirtualDub (Job control (F4) -> Edit -> Process directory). Just set Video and Audio to Direct Stream Copy prior to running Job control. Or just in case you haven't tried it yet, use -vcodec xvid -vtag divx.

jdlk
5th March 2007, 01:51
ilovejedd - thanks for your response. Very helpful. I used Nic's FourCC changer to change the header from 'xvid' to 'XVID' and my media player (Pinnacle Showcenter) recognised the file immediately!

I had tried the "-vcodec xvid -vtag divx" before, but that didn't help. But after trying the FourCC changer I took the next logical step and tried "-vcodec xvid -vtag XVID" - and it worked.

After spending hours trying all manner of obscure settings, it's a bit annoying that it comes down to that. Ridiculous, really. But I have my answer, and maybe it will help others. And thanks again, ilovejedd.

Incidentally, I also managed to get my Mencoder 2-pass working (schoolboy error in my command line). Interestingly, FFMPEG gives a notably smoother result on the Showcenter - the Mencoder output is slightly jerky. But on a first glance, the FFMPEG output does seem better to me, at equivalent bitrates, than my best efforts with DIVX. So the battle has been worth it.

weaver4
5th March 2007, 03:04
could you share the command lines that you ended up using?

Thanks

jdlk
5th March 2007, 03:22
could you share the command lines that you ended up using?
Thanks
Still playing around with them, but at the moment they look like this:

2 pass

for %%i in ("C:\blah\*.mpg") do ffmpeg -i "%%i" -vcodec xvid -vtag XVID -qscale 2 -s 624x352 -g 240 -passlogfile "%%i".log -pass 1 -an -y -f avi NUL
for %%i in ("C:\blah\*.mpg") do ffmpeg -i "%%i" -vcodec xvid -vtag XVID -pass 2 -qmin 2 -g 240 -b 1500k -s 624x352 -passlogfile "%%i".log -acodec mp3 -ab 128 -ac 2 -y -f avi "%%~dpi%%~ni.avi

1 pass

for %%i in ("C:\blah\*.mpg") do ffmpeg -i "%%i" -vcodec xvid -vtag XVID -qmin 2 -qscale 5 -s 624x352 -acodec mp3 -ab 128 -ac 2 "%%~dpi%%~ni.avi

ilovejedd
5th March 2007, 03:55
*sigh* Never had any luck with -vcodec xvid -vtag XVID with the build I'm using. It still gave me lower case 'xvid' fourcc that's why I had to resort to -vcodec xvid -vtag divx. Curiously enough, so long as I don't use 'xvid' or 'XVID' for -vtag, the fourcc is automatically all caps. Besides, I'm using XviD to decode both. Anyways, glad to be of help. :D