wiki/_next/data/Ie9t5zutrXP6Of75Cb5xF/cli.ffmpeg.json
2022-07-29 15:41:17 +00:00

1 line
11 KiB
JSON

{"pageProps":{"metadata":{"date":"\"2021-05-09 16:40:50 +08:00\"","date_modified":"\"2021-07-20 23:30:49 +08:00\"","language":"en","source":""},"title":"Command line: FFmpeg","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"options"},"children":[{"type":"text","value":"Options"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.ffmpeg#options"},"children":[{"type":"text","value":"Options"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.ffmpeg#examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"convert-an-mp3-to-ogg"},"children":[{"type":"text","value":"Convert an MP3 to OGG"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.ffmpeg#convert-an-mp3-to-ogg"},"children":[{"type":"text","value":"Convert an MP3 to OGG"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"transrate-an-audio-file"},"children":[{"type":"text","value":"Transrate an audio file"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.ffmpeg#transrate-an-audio-file"},"children":[{"type":"text","value":"Transrate an audio file"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"list-all-available-options"},"children":[{"type":"text","value":"List all available options"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.ffmpeg#list-all-available-options"},"children":[{"type":"text","value":"List all available options"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"capture-video-device"},"children":[{"type":"text","value":"Capture video device"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.ffmpeg#capture-video-device"},"children":[{"type":"text","value":"Capture video device"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"extract-a-segment-from-a-file"},"children":[{"type":"text","value":"Extract a segment from a file"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.ffmpeg#extract-a-segment-from-a-file"},"children":[{"type":"text","value":"Extract a segment from a file"}]}]}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The swiss army knife for interacting with multimedia files (except images because ImageMagick).\n"}]},{"type":"element","tagName":"h1","properties":{"id":"options"},"children":[{"type":"text","value":"Options"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The FFmpeg command line interface is mostly picky because of order.\nWhatever options are given will be processed with those options in order.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-hide_banner"}]},{"type":"text","value":" - hide the annoying banner\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-loglevel [level] | -v [level]"}]},{"type":"text","value":" - set the verbosity level\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-codecs"}]},{"type":"text","value":" - list all codecs\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-devices"}]},{"type":"text","value":" - list all devices\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-i [file]"}]},{"type":"text","value":" - the input file\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"c [codec]"}]},{"type":"text","value":" - set the codec\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-b [rate]"}]},{"type":"text","value":" - set the bitrate\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-o [file]"}]},{"type":"text","value":" - set the output\n"}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Certain options have the option of specifying whether you're interacting with the audio or video track.\nFor example, "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-codec:audio"}]},{"type":"text","value":" ("},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-c:a"}]},{"type":"text","value":") to set the audio codec.\n"}]},{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"FFmpeg is comprehensive and so needs some specific examples to fill my monkey brain.\n"}]},{"type":"element","tagName":"h2","properties":{"id":"convert-an-mp3-to-ogg"},"children":[{"type":"text","value":"Convert an MP3 to OGG"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"ffmpeg -i $INPUT.mp3 -o $OUTPUT.ogg\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"By default, FFmpeg will guess if certain things are missing.\nIn this case, it guessed the input file is an MP3 and wants to convert OGG.\nSometimes, it will also use default options for converting between two formats such as the default bitrate and codec.\n"}]},{"type":"element","tagName":"h2","properties":{"id":"transrate-an-audio-file"},"children":[{"type":"text","value":"Transrate an audio file"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"ffmpeg -i $INPUT -c $CODE -b:a $BITRATE $OUTPUT\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"list-all-available-options"},"children":[{"type":"text","value":"List all available options"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"FFmpeg has compile options, heaps of them.\nYou may want to know what codecs are available.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"ffmpeg -codecs\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It tends to be a large list so prepare to send it through a pager.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You should also know FFmpeg can print out devices.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"ffmpeg -devices\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"capture-video-device"},"children":[{"type":"text","value":"Capture video device"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"# Assuming /dev/video0 is your webcam.\nffmpeg -f video4linux2 -i /dev/video0 cringe-at-yourself.mpg\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"extract-a-segment-from-a-file"},"children":[{"type":"text","value":"Extract a segment from a file"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The timestamps are essentially seeking to a file.\nFor more information, see "},{"type":"element","tagName":"a","properties":{"href":"https://trac.ffmpeg.org/wiki/Seeking"},"children":[{"type":"text","value":"FFmpeg documentation"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"]},"children":[{"type":"text","value":"ffmpeg -nostdin -i $INPUT -ss 00:05:22 -to 00:22:43 $OUTPUT\n"}]}]}]},"backlinks":[]},"__N_SSG":true}