Hello
Quickly sharing some useful scripts I’ve “developed” over the summer to cope with some image resizing / video ripping / transcoding, etc.
Instead of using some specialized GUI software for transcoding I thought why not simply put useful options in the Windows file browser “Send To…” context menu. That way I can right-click the file I want to work with and just send it to some tool to do the job.
Here it is…
Update: One of the most useful documentation of DOS Batch scripts and variables can be found here.
How to install the scripts
Easily, press the windows key or the windows “Start” button (I’m using Windows7, but you can figure out your equivalent), and type in “shell:sendto”. This will open the directory where windows stores the options appearing in the “Send To…” context menu. Very useful!
Simply create a batch file (.bat extension) and put the script inside.
You can see I also put some other useful stuff there such as Dependency Walker, extremely good tool if you’re building Windows executable and DLLs and they crap out on you and you have no idea why. Especially for 64bit-32bit compatibility. Guhh I hate Windows (not really, it’s a love-hate relationship 🙂
You will also require the two magical tools:
Compress and Resize a video to 50%
del "%~p1%~n1_compress.avi" c:\Users\me\Downloads\ffmpeg-win32-static\bin\ffmpeg.exe -i "%~1" -vcodec msmpeg4v2 -qscale 10 -an -vf scale=iw/2:-1 "%~p1%~n1_compress.avi"
Convert all PNGs in directory to JPGs
mogrify -format jpg "%~dp1*.png" del "%~dp1*.png" PAUSE
(Sometimes I add “PAUSE” so the “Press any key…” will appear in the end of the execution)
Convert JPG images to mp4 video
del "%~dp1video.mp4" c:\Users\me\Downloads\ffmpeg-win32-static\bin\ffmpeg.exe -i "%~dp1keyframe%%04d.jpg" "%~dp1video.mp4" PAUSE
Resize all JPGs 50%
MD "%~dp1small" FOR %%a in ("%~dp1*.jpg") DO start /B convert "%%a" -resize 50%% "%%~dpasmall\%%~nxa" PAUSE
You can set up a few scripts with like: 33%, 50%, 66% and 75%
Convert video to images at 15FPS
mkdir "%~p1/images15fps" c:\Users\me\Downloads\ffmpeg-win32-static\bin\ffmpeg.exe -i "%~1" -f image2 -r 15 "%~p1images15fps\%%06d.png" PAUSE
Just the same you set up a few scripts for: 1FPS, 2FPS, 15FPS and 30FPS
To use them – simply right click the file (or in the case of working with a directory, a file in the directory) -> Send To … ->
That’s about it
Roy.