VideoExt aka Video

@fanningert:

Thank you for this great plugin.

As I develop on Windows, I have rewritten and expanded the script, I named this script “do_ffmpeg.bat”:


@ECHO OFF
ECHO "%~nx0" "%~1"
REM
REM # Windows-/DOS-Script
REM
REM This script ("do_ffmpeg.bat") takes any (high resolution) video file as input and converts it to MP4 (H264 & AAC), WebM (VP8 & Vorbis) and OGV (theora & vorbis) for HTML5 <video>. For each format, it creates a high quality ('.hq') and a low quality ('.lq') version.
REM
REM ffmpeg has to be installed, see http://ffmpeg.zeranoe.com/builds/ for downloads.
REM 
REM Usage: do_ffmpeg.bat <inputfile>
REM
REM Tip:   Drag the video file (inputfile) in the windows explorer and drop it on the icon of this script or the icon of a link to this script.
REM
REM This is heavily inspired by
REM - https://github.com/kornl/video-conversion/blob/master/convert_video_for_html_5.sh
REM - https://github.com/mickro/video2html5/blob/master/video2html5.sh
REM - http://diveintohtml5.info/video.html#webm-cli
REM
SET infile="%~1"
SET outfile=%~dpn1
SET filename=%~n1
REM ------------------------------------------------------
REM Start of your configuration area
REM
REM path to the utility ffmpeg.exe (surrounded by " . With or without drive like "C:". Without drive [e.g. 
for an USB-drive], if this script and the utility ffmpeg.exe are on the same drive):
SET prog="C:\path\to\the\ffmpeg.exe"
REM
REM add all options you like or need:
SET progoptions=-hide_banner
REM
REM End of your configuration area
REM ------------------------------------------------------
ECHO.
ECHO %%1       ='%1'
ECHO infile   =%infile%
ECHO outfile  ='%outfile%'
ECHO filename ='%filename%'
ECHO.
ECHO ffmpeg         =%prog%
ECHO ffmpeg-options ='%progoptions%'
ECHO.
ECHO.
IF /I "%1t" == "t" GOTO novideofile
IF /I NOT EXIST %prog% GOTO noprogfile
rem PAUSE
GOTO start
:novideofile
ECHO ERROR!
ECHO.
ECHO NO video file was passed as first parameter!
ECHO.
PAUSE
GOTO finish
:noprogfile
ECHO ERROR!
ECHO.
ECHO The file %prog% was not found (wrong path?)!
ECHO.
PAUSE
GOTO finish
:start
ECHO low quality MP4 (%filename%.lq.mp4)
START "ffmpeg lq.mp4" /WAIT %prog% -i %infile% -acodec aac -vcodec libx264 -vb 2000k -vf scale=iw/2:ih/2 -f mp4 %progoptions% -y "%outfile%.lq.mp4"
ECHO high quality MP4 (%filename%.hq.mp4)
START "ffmpeg hq.mp4" /WAIT %prog% -i %infile% -acodec aac -vcodec libx264 -vb 8000k -f mp4 %progoptions% -y "%outfile%.hq.mp4"
ECHO.
ECHO low quality WebM (%filename%.lq.webm)
START "ffmpeg lq.webm" /WAIT %prog% -i %infile% -acodec libvorbis -vcodec libvpx -vb 2000k -vf scale=iw/2:ih/2 -f webm %progoptions% -y "%outfile%.lq.webm"
ECHO high quality WebM (%filename%.hq.webm)
START "ffmpeg hq.webm" /WAIT %prog% -i %infile% -acodec libvorbis -vcodec libvpx -vb 8000k -f webm %progoptions% -y "%outfile%.hq.webm"
ECHO.
ECHO low quality OGV (%filename%.lq.ogv)
START "ffmpeg lq.ogv" /WAIT %prog% -i %infile% -acodec libvorbis -vcodec libtheora -vb 2000k -vf scale=iw/2:ih/2 %progoptions% -y "%outfile%.lq.ogv"
ECHO high quality OGV (%filename%.hq.ogv)
START "ffmpeg hq.ogv" /WAIT %prog% -i %infile% -acodec libvorbis -vcodec libtheora -vb 8000k %progoptions% -y "%outfile%.hq.ogv"
ECHO.
ECHO a single image (for "poster: %filename%.jpg")
START "ffmpeg image" /WAIT %prog% -ss 0.5 -i %infile% -vframes 1 -q:v 2 %progoptions% -y "%outfile%.jpg"
ECHO.
:ready
ECHO.
ECHO READY!
ECHO.
ECHO The seven new files wait at "%~dp1%"
ECHO.
PAUSE
:finish
EXIT



Good luck!

[Edited:]
The script has been revised (more robust against spaces in the paths and more informative).

1 Like