Romain 5f963736c1 | |
---|---|
Licence note | |
README.md | |
ffmpeg_ein.sh |
FFmpeg wrapper to encode upon some conditions.
The script can be use "as is" with a command like ./ffmpeg_ein.sh
but
you could also "install" it with something like:
mv ffmpeg_ein.sh /usr/bin/ffmpeg_ein
ffmpeg_ein [OPTION] [INPUT]
Refer to the -h
argument to get the full list of options.
By default, FFmpeg encode a file regardless of the fact that the original and selected codec are the same. Although it may be be a desired outcome, it can lead to unnecessary operations losing time and quality.
This script allow the user to specified a desired codec for audio and video, only if either of those are not present an encoding will be triggered.
For example if the desired codecs are aac/h264 and the source file is wmav2/h264 then the file will be encoded with aac and the h264 stream copied.
Desired ( -a aac ) |
Source | FFmpeg option |
---|---|---|
aac | aac | -c:a copy |
aac | X | content of -b |
Warning, by default no output is set, use the -d
option or specify
the output file with -o
.
This script is designed to be batch friendly allowing the sorting of processed and sources files within multiple directories. The following points also help in this endeavor:
-d
option.ffmpeg_ein \
-a aac -b "-c:a aac -b:a 48k" \
-v h264 -u "-c:v libx264 -crf 23" \
-d /tmp/ \
[FILE]
Will result in the encoding of the file(s) [FILE] if either their audio codec is not "aac" or their video codec is not "h264". The result encoded file(s) (if created) will have the same name as the original(s) and be placed in the "/tmp" folder.
Desired | Source | FFmpeg option |
---|---|---|
aac/h264 | aac/h264 | -c:a copy -c:v copy |
aac/h264 | X/h264 | -c:a aac -b:a 48k -c:v copy |
aac/h264 | aac/X | -c:a copy -c:v libx264 -crf 23 |
aac/h264 | X/X | -c:a aac -b:a 48k -c:v libx264 -crf 23 |