ffmpeg - bunnyamin/bunnix GitHub Wiki
Command | Example | Comment |
---|---|---|
Print all metadata | ffprobe -v error -show_format -show_streams <FILE> |
|
Print bitrate data without element (bit_rate= ) from audio stream |
ffprobe -v error -show_entries stream=bit_rate -select_streams a -of default=noprint_wrappers=1:nokey=1 <FILE> |
Can return "N/A" for example weba ; try format=bit_rate instead of stream=bit_rate . |
Print bitrate data without element (bit_rate= ) from audio stream, using format=bit_rate
|
ffprobe -v error -show_entries format=bit_rate -select_streams a -of default=noprint_wrappers=1:nokey=1 <FILE> |
|
Print bitrate data without element (bit_rate= ) from audio stream, all files in directory |
for i in *.<FILE EXT>; do echo "$i"; ffprobe -v error -show_entries stream=bit_rate -select_streams a -of default=noprint_wrappers=1:nokey=1 "$i"; done; |
|
Print bitrate data without element (bit_rate= ) from audio stream, all files in directory if bitrate above 128Kb |
for i in *.<FILE EXT>; do br=$(ffprobe -v error -show_entries stream=bit_rate -select_streams a -of default=noprint_wrappers=1:nokey=1 "$i"); if [ "$br" -gt 128000 ]; then echo "$br $i"; fi; done; |
Command | Example | Comment |
---|---|---|
Copy | ffmpeg -i <FILE>.<EXT> -c copy <FILE>.<EXT> |
|
Copy all files in a directory | for i in *.<FILE EXT>; do ffmpeg -i "$i" -c copy "$(basename "${i/.<FILE EXT>}").<FILE EXT>"; done; |
Command | Example |
---|---|
Crop, extract sound from sound and copy the stream | ffmpeg -ss <00:00:00> -to <00:00:00> -i "<INPUT FILE>" -c copy <OUTPUT FILE> |
Crop, extract sound from video and copy the stream | ffmpeg -ss <00:00:00> -to <00:00:00> -i "<INPUT FILE>" -acodec copy <OUTPUT FILE> |
Crop, extract specific sound encoding from video and copy the stream | ffmpeg -ss <SECONDS> -to <SECONDS> -i "<INPUT FILE>" -acodec <ENCODING> -c copy <OUTPUT FILE> |
- FFmpeg MP3 Encoding Guide
- Print expected file output
for i in *.<FILE EXT>; do echo "$(basename "${i/.<FILE EXT>}").mp3"; done;
Command | Example |
---|---|
VBR |
ffmpeg -i <INPUT FILE>.* -vn -codec:a libmp3lame -q:a 0 <OUTPUT FILE>.mp3 |
VBR , all files in a directory |
for i in *.<FILE EXT>; do ffmpeg -i "$i" -vn -codec:a libmp3lame -q:a 0 "$(basename "${i/.<FILE EXT>}").mp3"; done; |
CBR , 128kb
|
ffmpeg -i <INPUT FILE>.* -vn -codec:a libmp3lame -b:a 128k <OUTPUT FILE>.mp3 |
CBR , 128kb , all files in a directory |
for i in *.<FILE EXT>; do ffmpeg -i "$i" -vn -codec:a libmp3lame -b:a 128k "$(basename "${i/.<FILE EXT>}").mp3"; done; |
CBR , preserve bitrate, all files in a directory |
for i in *.<FILE EXT>; do br=$(ffprobe -v error -show_entries stream=bit_rate -select_streams a -of default=noprint_wrappers=1:nokey=1 "$i"); ffmpeg -i "$i" -vn -codec:a libmp3lame -b:a $br "$(basename "${i/.<FILE EXT>}").mp3"; done; |
Event | Error | Cause | Consequence | Remedy |
---|---|---|---|---|
ffmpeg -ss ... -to ... -i ... -c copy ... |
[mp3 @ 0x5591eee4f140] Audio packet of size 557 (starting with 49443304...) is invalid, writing it anyway. | Unknown | Unknown |