-
Notifications
You must be signed in to change notification settings - Fork 0
01_ffmpeg
ffmpeg -hide_banner -loglevel Warning -i input.webm -c:a aac -b:a 128k -c:v libx264 -b:v 1000k -s 1920x1080 -r 25 output.mp4
### remove audio from file:
ffmpeg -i 1.mp4 -c copy -an out.mp4
### Video to audio
ffmpeg -i 1.mp4 -vn out.mp3
### speed up/down:
ffmpeg -i 1.mp4 -filter:v "setpts=PTS/10" output.mp4
### concat file from file list:
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
content of list .txt:
file '/home/davood/Desktop/video/out.mp4' file '/home/davood/Desktop/video/out2.mp4'
### remove extra text:
ffmpeg -hide_banner ...
### use cuda:
ffmpeg -hwaccel cuda ...
### just copy audio:
ffmpeg -c:a copy ...
### just copy video:
ffmpeg -c:v copy ...
### set audio container to AAC and bitrate to 128k:
ffmpeg -i input.mp4 -c:v copy -c:a libfdk_aac -b:a 128k output.mp4
it might not work in windows, so use built-in AAC:
... -c:a aac ...
### set video container to H.264 and bitrate to 1MB/s:
ffmpeg -i input -c:v libx264 -c:a copy output.mp4
### two pass encoding:
> Windows users should use NUL instead of /dev/null and ^ (in command prompt) or ` (in PowerShell) instead of \.
ffmpeg -y -i input -c:v libx264 -b:v 2600k -pass 1 -an -f null /dev/null &&
ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4
### change dimension:
ffmpeg -i input.mp4 -s 1920x1080 output.mp4
### change frame rate:
ffmpeg -i input.mp4 -r 25 output.mp4
### rotation:
ffmpeg -i in.mov -vf "transpose=1" out.mov
0 = 90CounterCLockwise and Vertical Flip (default) 1 = 90Clockwise 2 = 90CounterClockwise 3 = 90Clockwise and Vertical Flip
### cut a part of file:
//// with start and stop time: ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:05 output.mp4
//// with start and duration(in seconds): ffmpeg -i input.mp4 -ss 00:01:00 -t 100 output.mp4
### set encoding preset:
... -preset ultrafast ... ... -preset veryslow ...
### set lossless H.264:
... -qp 0 ...
### restict CPU usage
to use 2 cores:
- threads 2
### Log levels
ffmpeg -loglevel
defaul level is warning. available log levels, from less info to more info:
Quiet Panic Fatal Error Warning Info Verbose Debug
[reference](https://opensource.com/article/17/6/ffmpeg-convert-media-file-formats)
[reference on presets and encoding](https://trac.ffmpeg.org/wiki/Encode/H.264)