pdf How to create a thumbnail from a video with a DOS script and ffmpeg
Par keyphrene, Thursday 30 December 2010 à 07:39 :: Shell Windows :: #31 :: rss
How to create a thumbnail from a video with a DOS script and FFMPEG
- Dowload FFMPEG for Windows ffmpeg.zip
- Create Thumbnails _movies.bat on your desktop.
- Define ffmpeg.exe into FFMPEG variable.
- Drag and drop a directory or file movie above your script.
- This script is recursive for your directory
@echo off set FFMPEG=D:\share\ffmpeg.exe set PATHIN=%1 set RNDSTART=100 set RNDEND=200 SETLOCAL enabledelayedexpansion call:IsDir %PATHIN% IF %ERRORLEVEL% == 0 ( REM This is a directory FOR /R %PATHIN% %%I IN (*.avi *.mkv) DO ( echo "%%~dpI" IF NOT EXIST "%%~dpnI.jpeg" ( echo "%%~dpnI.jpeg" call:Randomize rnd "%RNDSTART%" "%RNDEND%" %FFMPEG% -itsoffset -!rnd! -y -i "%%~fI" -vcodec mjpeg -vframes 1 -an -f rawvideo -s 128x128 "%%~dpnI.jpeg" > NUL 2>&1 ) ) ) ELSE ( REM This is a file call:FilenameFormat ret %PATHIN% dpn; IF NOT EXIST "!ret!.jpeg" ( echo "!ret!.jpeg" call:Randomize rnd "%RNDSTART%" "%RNDEND%"; REM echo %FFMPEG% -itsoffset -!rnd! -y -i %PATHIN% -vcodec mjpeg -vframes 1 -an -f rawvideo -s 128x128 "!ret!.jpeg" %FFMPEG% -itsoffset -!rnd! -y -i %PATHIN% -vcodec mjpeg -vframes 1 -an -f rawvideo -s 128x128 "!ret!.jpeg" > NUL 2>&1 ) ) pause REM =================== REM = Functions REM =================== :FilenameFormat SETLOCAL IF "%~1"=="" GOTO:EOF FOR %%i IN ("%~2") DO SET r=%%~%~3i ( ENDLOCAL SET "%~1=%r%" ) GOTO:EOF :IsDir FOR /F "delims=" %%i IN ("%~1") DO SET MYPATH="%%~fi" PUSHD %MYPATH% 2>NUL IF ERRORLEVEL 0 ( POPD ) GOTO:EOF :Randomize SETLOCAL IF "%~2"=="" GOTO:EOF SET /a "r=%RANDOM% %% %~3 + %~2" > NUL ( ENDLOCAL set "%~1=%r%" ) GOTO:EOF
TAGS : FFMPEG thumbnail movie script DOS

Comments
No comment for this moment.
Add a comment