====== ffmpeg ======
===== Letöltés =====
* [[https://www.ffmpeg.org/download.html]]
* [[http://ffmpeg.zeranoe.com/builds/]]
===== Paraméterezés =====
* [[http://askubuntu.com/questions/265176/how-to-convert-a-video-from-mp4-flv-to-mpeg-mpg]]
* [[https://trac.ffmpeg.org/wiki/Encode/H.264]]
==== Forrás átkódolásának kihagyása (csak másolás) ====
-vcodec copy
-acodec copy
==== Elforgatás ====
* [[http://stackoverflow.com/a/9570992/1108919]]
# -vf filter_graph set video filters
# transpose AVOptions:
# dir ..FV.... set transpose direction (from 0 to 7) (default 0)
# 0 = 90CounterCLockwise and Vertical Flip (default)
# 1 = 90Clockwise
# 2 = 90CounterClockwise
# 3 = 90Clockwise and Vertical Flip
-vf transpose=1
==== Arányos átméretezés szélesség/magasság megadásával ====
* [[https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg]]
-vf scale=1920:-1
-vf scale=-1:1080
==== Gyors indítás streamelés esetén ====
# -movflags E....... MOV muxer flags (default 0)
# faststart E....... Run a second pass to put the index (moov atom) at the beginning of the file
-movflags +faststart
==== Minőség profilok ====
* [[http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels]]
* [[https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility]]
-profile:v high -level:v 4.0
-profile:v high -level:v 4.1
==== Színtér ====
* [[http://stackoverflow.com/a/15780960/1108919]]
-pix_fmt yuv420p # for compatibility with outdated media players.
===== Példák =====
* Mezítlábas átkódolás:
ffmpeg -i "src.mpg" -vcodec h264 -acodec ac3 -movflags +faststart "dst.mkv"
ffmpeg -i "src.mov" -c:v libx264 -c:a ac3 -movflags +faststart "dst.mkv"
* Elforgatás és átmérezetés egyszerre:
ffmpeg -i "src.mp4" -c:v libx264 -c:a ac3 -vf transpose=1,scale=-1:1080 -movflags +faststart "dst.mkv"
* Profil megadása:
ffmpeg -i "src.mp4" -c:v libx264 -c:a ac3 -profile:v high -level:v 4.1 -movflags +faststart "dst.mkv"
* Ciklusban:
for %f in (*.mp4) do ffmpeg -i "%f" -vcodec h264 -acodec ac3 -movflags +faststart "%f.mkv"
==== Minden hasznos egyben ====
ffmpeg -i "%f" -c:v libx264 -c:a ac3 -profile:v high -level:v 4.1 -pix_fmt yuv420p -movflags +faststart "%f.mkv"
===== Indító script Windows-hoz =====
''C:\Program Files\ffmpeg\ff-prompt.bat''
@ECHO OFF
REM FF Prompt 1.1
REM Open a command prompt to run ffmpeg/ffplay/ffprobe
REM Copyright (C) 2013 Kyle Schwarz
TITLE FF Prompt
IF NOT EXIST "C:\Program Files\ffmpeg\bin\ffmpeg.exe" (
CLS
ECHO "C:\Program Files\ffmpeg\bin\ffmpeg.exe" could not be found.
GOTO:error
)
CLS
SET PATH=C:\Program Files\ffmpeg\bin;%PATH%
ffmpeg -version
ECHO.
ECHO For help run: ffmpeg -h
ECHO For formats run: ffmpeg -formats ^| more
ECHO For codecs run: ffmpeg -codecs ^| more
ECHO.
ECHO The bin directory has been added to PATH
ECHO.
IF NOT "%*" == "" (
CMD /K CD /d "%*"
) ELSE (
CMD
)
GOTO:EOF
:error
ECHO.
PAUSE
GOTO:EOF
===== MP3 újra kódolása =====
* https://trac.ffmpeg.org/wiki/Encode/MP3
@echo off
SET PATH=C:\Program Files\ffmpeg\bin;%PATH%
call :convert "01 foo.mp3"
call :convert "02 bar.mp3"
goto :eof
:convert
del "x\%~1"
ffmpeg -i "%~1" -acodec mp3 -aq 2 "x\%~1"
goto :eof