-
Notifications
You must be signed in to change notification settings - Fork 0
01_ffmpeg
Davood Dorostkar edited this page Apr 18, 2024
·
29 revisions
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
ffmpeg -i 1.mp4 -c copy -an out.mp4
ffmpeg -i 1.mp4 -vn out.mp3
speed up video only:
ffmpeg -i 1.mp4 -vf "setpts=PTS/10" output.mp4
speed up audio only:
ffmpeg -i input.mp4 -af "atempo=1.1" out.mp4
you can use both flags together
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'
ffmpeg -hide_banner ...
ffmpeg -hwaccel cuda ...
ffmpeg -c:a copy ...
ffmpeg -c:v copy ...
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 ...
ffmpeg -i input -c:v libx264 -c:a copy output.mp4
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
ffmpeg -i input.mp4 -s 1920x1080 output.mp4
ffmpeg -i input.mp4 -r 25 output.mp4
ffmpeg -i in.mov -vf "transpose=1" out.mov
0 = 90CounterCLockwise and Vertical Flip (default)
1 = 90Clockwise
2 = 90CounterClockwise
3 = 90Clockwise and Vertical Flip
//// 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
//// from second 3 to end:
ffmpeg -i input.mp4 -ss 3 -c copy output.mp4
... -preset ultrafast ...
... -preset veryslow ...
greater numbers lead to less quality and size (constant rate factor):
... -crf 23 ...
... -qp 0 ...
to use 2 cores:
- threads 2
ffmpeg -loglevel <LEVEL>
defaul level is warning. available log levels, from less info to more info:
quiet
panic
fatal
error
warning
info
verbose
debug
ffmpeg -framerate 10 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p output.mp4
ffmpeg -i input.png output.jpg
changing quality:
-q:v 2
: sets the quality of the output JPEG. The value can range from 2 to 31, where 2 is the highest quality and 31 is the lowest.
ffmpeg -i input.png -q:v 2 output.jpg
Using percentage based compression
ffmpeg -i input.png -compression_level 100 output.jpg
changing size:
ffmpeg -i input.png -vf "scale=iw*0.5:ih*0.5" output.jpg