FFmpeg: Difference between revisions
Jump to navigation
Jump to search
m →Usage |
mNo edit summary |
||
| Line 33: | Line 33: | ||
==Usage== | ==Usage== | ||
FFmpeg needs to be run from the command line, but you can create batch scripts to automate the process for multiple files. | FFmpeg needs to be run from the command line, but you can create batch scripts to automate the process for multiple files. There is also a plugin for Python (https://pypi.org/project/ffmpeg-python/), but it is fairly limited so we recommend using subprocess instead (see example below). | ||
The following are examples of conversions that we commonly use. | The following are examples of conversions that we commonly use. | ||
| Line 82: | Line 82: | ||
===Batching=== | ===Batching=== | ||
The following is a batch script (text file with .bat file extension) that converts all .mp4 files in the specified folder to .avi: | The following is a batch script (text file with .bat file extension) that converts all .mp4 files in the specified folder to .avi: | ||
< | <syntaxhighlight lang="batch" overflow:auto;">@echo off | ||
setlocal enabledelayedexpansion | setlocal enabledelayedexpansion | ||
| Line 97: | Line 97: | ||
pause | pause | ||
</ | </syntaxhighlight > | ||
===Python=== | |||
<syntaxhighlight lang="python" overflow:auto;">import subprocess | |||
inputFile = "input.mov" | |||
outputFile = "output.mp4" | |||
subprocess.run(f'ffmpeg -i "{inputFile}" -vcodec h264 -b:v 8M "{outputFile}"') | |||
</syntaxhighlight > | |||
==See Also== | ==See Also== | ||
* [[Video Codecs]] | * [[Video Codecs]] | ||