View Full Version : Batch transcoding to PSP (>= 2.80)
quake74
6th December 2006, 15:10
I just decided to upgrade the PSP to a newer firmware, and now that it doesn't need atomchanger any more nor any weird filenames, it should be possible to create a bat file that I can run on a video file which generates a compatible mp4, but...
The main problem is the level. AFAIK, only the 3GP version of ffmpeg and x264 can set the level to what's needed (<=2.1) and all other applications just set 5.1 (why can't I set it with mp4box?). ffmpeg is a nice program, but i don't understand how to set the different h264 options (like crf, rdo, me, bime, etc), and it's kinda dated (there are newer versions but not of the 3GP family). The main problem with x264 is that it needs avisynth, which I'd rather not use. I already have mplayer and ffmpeg which read all the files I'm interested in, but I cannot pipe their output to x264. Help!
quake74
7th December 2006, 11:17
Seems no one is interested, anyway, just for the record, here's what I could come up with
echo DirectShowSource("%~f1",fps=25,convertfps=true,audio=false) > "%~dpn1_tmp.avs"
echo LanczosResize(368,208) >> "%~dpn1_tmp.avs"
x264.exe "%~dpn1_tmp.avs" --crf 26 --stats ".stats" --level 2.1 --no-fast-pskip --bframes 1 --b-rdo --bime --weightb --direct auto --subme 6 --trellis 1 --analyse p8x8,b8x8,i4x4,p4x4 --me umh --thread-input --progress --no-psnr --output "%~dpn1_video.mp4" "%~dpn1_tmp.avs"
ffmpeg.exe -vn -i "%~f1" "%~dpn1_audio.wav"
neroaacenc.exe -he -q 0.15 -if "%~dpn1_audio.wav" -of "%~dpn1_audio.mp4"
mp4box.exe -add "%~dpn1_video.mp4" -add "%~dpn1_audio.mp4" -sbr -new "%~dpn1_x264.mp4"
Hyper Shinchan
7th December 2006, 12:00
The main problem is the level. AFAIK, only the 3GP version of ffmpeg and x264 can set the level to what's needed (<=2.1) and all other applications just set 5.1 (why can't I set it with mp4box?). ffmpeg is a nice program, but i don't understand how to set the different h264 options (like crf, rdo, me, bime, etc), and it's kinda dated (there are newer versions but not of the 3GP family). The main problem with x264 is that it needs avisynth, which I'd rather not use. I already have mplayer and ffmpeg which read all the files I'm interested in, but I cannot pipe their output to x264. Help!
Why you don't want to use avs? It's really easy to use. MeGUI allows you to set the level and it can also correct the level to your specified settings. If you want to use x264 you must use x264.exe imo :) . Forget about mplayer and ffmpeg at least if you are on Windows.
quake74
7th December 2006, 12:33
Why you don't want to use avs?
Mainly because of issues with directshowsource. It is nowhere near as stable as ffmpeg or mplayer for reading files. Moreover this forces me to have the proper codecs-splitters installed, which is another bag of crap which I live with, but rather not.
quake74
7th December 2006, 22:03
Always in the interest of curiosity, now the avs file can autodetect the aspect ratio of the file and decide whether to rescale to 320x240 368x208 or 416x176
echo DirectShowSource("%~f1",fps=25,convertfps=true,audio=false) > "%~dpn1_tmp.avs"
echo source = last >> "%~dpn1_tmp.avs"
echo sw = float(source.width) >> "%~dpn1_tmp.avs"
echo sh = float(source.height) >> "%~dpn1_tmp.avs"
echo sar = sw/sh >> "%~dpn1_tmp.avs"
echo ARError43 = Abs((1.33/sar)-1) >> "%~dpn1_tmp.avs"
echo ARError169 = Abs((1.77/sar)-1) >> "%~dpn1_tmp.avs"
echo ARError233 = Abs((2.33/sar)-1) >> "%~dpn1_tmp.avs"
echo MinARE = (ARError43^<ARError169)?ARError43:ARError169 >> "%~dpn1_tmp.avs"
echo MinARE = (MinARE^<ARError233)?MinARE:ARError233 >> "%~dpn1_tmp.avs"
echo video = (MinARE==ARError43)?source.LanczosResize(320,240):source >> "%~dpn1_tmp.avs"
echo video = (MinARE==ARError169)?source.LanczosResize(368,208):video >> "%~dpn1_tmp.avs"
echo video = (MinARE==ARError233)?source.LanczosResize(416,176):video >> "%~dpn1_tmp.avs"
echo return video >> "%~dpn1_tmp.avs"
"x264.exe" "%~dpn1_tmp.avs" --crf 28 --stats ".stats" --level 2.1 --no-fast-pskip --bframes 1 --b-rdo --bime --weightb --direct auto --subme 6 --trellis 1 --analyse p8x8,b8x8,i4x4,p4x4 --me umh --thread-input --progress --no-psnr --output "%~dpn1_video.mp4" "%~dpn1_tmp.avs"
"ffmpeg.exe" -vn -i "%~f1" "%~dpn1_audio.wav"
IF ERRORLEVEL 1 "mplayer.exe" "%~f1" -vc null -vo null -ao pcm:fast:waveheader:file="audio.wav"
IF EXIST "audio.wav" (move "audio.wav" "%~dpn1_audio.wav")
"level.exe" "%~dpn1_audio.wav" "%~dpn1_audio.wav"
"neroaacenc.exe" -he -q 0.15 -if "%~dpn1_audio.wav" -of "%~dpn1_audio.mp4"
IF ERRORLEVEL 1 "neroaacenc.exe" -lc -q 0.15 -if "%~dpn1_audio.wav" -of "%~dpn1_audio.mp4"
"mp4box.exe" -add "%~dpn1_video.mp4" -add "%~dpn1_audio.mp4" -sbr -new "%~dpn1_psp.mp4"
pause
To use it, make it into a convert.bat file and then "convert.bat movie.avi" or just drag and drop over it.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.