xe1phix

Xe1phix-[FFmpeg]-Cheatsheet-[.v28.7.4.].sh

Sep 21st, 2022 (edited)
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 87.34 KB | None | 0 0
  1. ffmpeg -codecs
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. ffmpeg --dump_stream_info
  9.  
  10.  
  11. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  12. echo "    [+] AVI File --> MP4 File:       "
  13. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  14. ffmpeg -i $input.avi $output.mp4
  15.  
  16.  
  17. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  18. echo "    [+] MP3 File --> OGG File:       "
  19. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  20. ffmpeg -i $input.mp3 $output.ogg
  21.  
  22.  
  23.  
  24. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  25. echo "    [+] MP4 File --> WEBM File       "
  26. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  27. ffmpeg -i $input.mp4 $output.webm
  28.  
  29.  
  30.  
  31. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  32. echo "    [+] MOV File --> MP4 File       "
  33. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  34. ffmpeg -i $Input.mov $Output.mp4
  35.  
  36.  
  37. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  38. echo "    [+] MP3 File --> OGG File       "
  39. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  40. ffmpeg -i $input.mp3 $output.ogg
  41.  
  42.  
  43.  
  44. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  45. echo "    [+] Convert a .mkv to .webm:         "
  46. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  47. ffmpeg -i $input.mkv $output.webm
  48.  
  49.  
  50. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  51. echo "    [+] Convert a .mkv to .mp4:         "
  52. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  53. ffmpeg -i $input.mkv $output.mp4
  54.  
  55.  
  56.  
  57.  
  58. echo "##-=====================================-##"
  59. echo "    [+] copy the video stream from:    "
  60. echo "        input.webm --> output.mkv      "
  61. echo "##-=====================================-##"
  62. echo "## ---------------------------------------------------- ##"
  63. echo "    [?] Encode the Vorbis audio stream into a FLAC."
  64. echo "## ---------------------------------------------------- ##"
  65. ffmpeg -i $Input.webm -c:v copy -c:a flac $Output.mkv
  66.  
  67. ffmpeg -i $Input.webm -c:av copy $Output.mkv
  68.  
  69.  
  70. ##-=======================================================-##
  71. ##   [+]  Creates a GIF From A MKV
  72.  
  73. ## ----------------------------- ##
  74. ##   [+] Convert MKV --> GIF
  75. ## ----------------------------- ##
  76.  
  77. ## --------------------------------------------------- ##
  78. ##   [+] Use the same dimensions as the input file
  79. ## --------------------------------------------------- ##
  80. ffmpeg -i $Input.mkv $Output.gif
  81.  
  82.  
  83.  
  84.  
  85. echo "##-===========================================================-##"
  86. echo "     [+] Extracts Only The Audio From The .mkv, And               "
  87. echo "         Encodes It As mp3, And Saves It Into $Output.ogg          "
  88. echo "##-===========================================================-##"
  89. ffmpeg -i $Input.mkv -vn $Output.ogg
  90.  
  91.  
  92.  
  93. echo "##-===========================================================-##"
  94. echo "     [+] Extracts Only The Audio From The .mkv, And               "
  95. echo "         Encodes It As mp3, And Saves It Into $Output.mp3          "
  96. echo "##-===========================================================-##"
  97. ffmpeg -i $Input.mkv -vn $Output.mp3
  98.  
  99.  
  100. # Extract audio from a video
  101. ffmpeg -i video.avi -f mp3 audio.mp3
  102.  
  103.  
  104. echo "##-===========================================================-##"
  105. echo "     [+] Extracts Only The Audio From The .mp4, And               "
  106. echo "         Encodes It As mp3, And Saves It Into $Output.mp3          "
  107. echo "##-===========================================================-##"
  108. ffmpeg -i $Input.mp4 -acodec libmp3lame -b:a 256k -vn $Output.mp3
  109.  
  110. ffmpeg -i $Input.mp4 -acodec libmp3lame -b:a 192k -vn $Output.mp3
  111.  
  112. ffmpeg -i $Input.mp4 -acodec libmp3lame -b:a 320k -vn $Output.mp3
  113.  
  114.  
  115. ffmpeg -i $File.mp4 -acodec libmp3lame -b:a 256k -vn $File.mp3
  116.  
  117.  
  118.  
  119. ffmpeg -i $File.mp4 -acodec libmp3lame -b:a 256k -vn $File.mp3
  120.  
  121.  
  122. ffmpeg -i $File.mp4 -acodec libmp3lame -b:a 320k -vn $File.mp3
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  134. echo "    [+] Synchronize The Audio And Video:   "
  135. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  136. echo "## -------------------------------------------------------------------------------------- ##"
  137. echo "    [?] To ensure that audio and video synchronize during playback insert keyframes.        "
  138. echo "## -------------------------------------------------------------------------------------- ##"
  139. ffmpeg -i $File.mp4 -keyint_min 150 -g 150 -f webm -vf setsar=1:1 $File.webm
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  149. echo "    [+] MP4 File --> H.264           "
  150. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  151. ffmpeg -i $File.mp4 -c:v libx264 -c:a copy $File.mp4
  152.  
  153.  
  154.  
  155. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  156. echo "    [+] Extract The Audio From An MP4 File:       "
  157. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  158.  
  159.  
  160.  
  161. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  162. echo "    [+] Convert A WEBMs Audio To VP9:       "
  163. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  164. ffmpeg -i $File.webm -v:c libvpx-vp9 -v:a copy $File.webm
  165.  
  166.  
  167.  
  168. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  169. echo "    [+] Copy A Webms Audio Into Another Webm:       "
  170. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  171. ffmpeg -i $File.webm -v:c copy -v:a libvorbis $File.webm
  172. ffmpeg -i $File.webm -v:c copy -v:a libopus $File.webm
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  183. echo "    [+] list the supported, connected capture devices:       "
  184. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  185. ffmpeg -y -f vfwcap -i list
  186.  
  187.  
  188.  
  189. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  190. echo "    [+] List device capabilities:          "
  191. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  192. ffmpeg -f v4l2 -list_formats all -i /dev/video0
  193.  
  194.  
  195. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  196. echo "    [+] Encode video from /dev/video0:     "
  197. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  198. ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 $output.mkv
  199.  
  200.  
  201.  
  202. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  203. echo "    [+] Print The Codecs Supported By FFmpeg:        "
  204. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  205. ffmpeg -codecs
  206.  
  207.  
  208. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  209. echo "    [+] Send program-friendly progress information:  "
  210. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  211. ffmpeg -progress
  212.  
  213.  
  214.  
  215. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  216. echo "    [+] see if an audio file contains the album cover:         "
  217. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  218. ffmpeg -i $input.mp3
  219.  
  220.  
  221. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  222. echo "    [+] show the album cover and play the music:         "
  223. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  224. ffplay -i $input.mp3
  225.  
  226.  
  227. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  228. echo "    [+] use it as the video For your music that you want to upload to YouTube:       "
  229. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  230. ffmpeg -i $input.mp3 -c copy $output.mkv
  231.  
  232.  
  233.  
  234. echo "##-=========================-##"
  235. echo "    || -V0 || ~245 kbps ||     "
  236. echo "    || -V1 || ~225 kbps ||     "
  237. echo "    || -V2 || ~190 kbps ||     "
  238. echo "    || -V3 || ~175 kbps ||     "
  239. echo "##-=========================-##"
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  248. echo "    [+] generate A framemd5 report:"
  249. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  250. ffmpeg -i $MOVIE.mov -f framemd5 $MOVIE.framemd5
  251.  
  252.  
  253. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  254. echo "    [+] Adds -c copy Parameter To The Syntax:        "
  255. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  256. echo "## -------------------------------------------------------- ##"
  257. echo "    [?] which causes the framemd5 to                          "
  258. echo "    [?] generate checksums of the data                        "
  259. echo "    [?] as it is stored:                                      "
  260. echo "## -------------------------------------------------------- ##"
  261. ffmpeg -i $MOVIE.mov -c copy -f framemd5 $MOVIE.framemd5
  262.  
  263.  
  264.  
  265. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  266. echo "    [+] 2-pass VP9 encoding with FFMpeg:         "
  267. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  268. echo "## -------------------------------------------------------------------------------------------- ##"
  269. echo "    [?] c:v libvpx-vp9 - tells FFmpeg to encode the video in VP9:                                 "
  270. echo "    [?] c:a libopus    - tells FFmpeg to encode the audio in Opus:                                "
  271. echo "    [?] b:v 1000K      - tells FFmpeg to encode the video with a target of 1000 kilobits:         "
  272. echo "    [?] b:a 64k        - tells FFmpeg to encode the audio with a target of 64 kilobits:           "
  273. echo "## -------------------------------------------------------------------------------------------- ##"
  274.  
  275. ffmpeg -i $Source -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 8 -speed 4 -tile-columns 6 -frame-parallel 1 -an -f webm /dev/null
  276.  
  277. ffmpeg -i $Source -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 8 -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -f webm $out.webm
  278.  
  279.  
  280.  
  281.  
  282.  
  283. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  284. echo "    [+] Best Quality (Slowest) Recommended Settings:"
  285. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  286. ffmpeg -i $Source -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 1 -speed 4 -tile-columns 0 -frame-parallel 0 -g 9999 -aq-mode 0 -an -f webm /dev/null
  287.  
  288.  
  289.  
  290. ffmpeg -i $Source -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 1 -speed 0 -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 25 -g 9999 -aq-mode 0 -c:a libopus -b:a 64k -f webm $out.webm
  291.  
  292.  
  293.  
  294.  
  295.  
  296. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  297. echo "    [+] Extract images from a video:         "
  298. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  299. ffmpeg -i $foo.avi -r 1 -s WxH -f image2 $foo-%03d.jpeg
  300.  
  301.  
  302.  
  303. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  304. echo "    [+] Grab the X11 display with ffmpeg:        "
  305. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  306. ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0 /tmp/$out.mpg
  307.  
  308.  
  309.  
  310. echo "## -------------------------------------------------------------- ##"
  311. echo "    [?] 0.0 is display.screen number of your X11 server,            "
  312. echo "    [?] same as the DISPLAY environment variable.                   "
  313. echo "## -------------------------------------------------------------- ##"
  314. ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0+10,20 /tmp/$out.mpg
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  324. echo "    [+] Global Metadata in WebM:       "
  325. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  333. echo "    [+] WebVTT Metadata Common To WebM:        "
  334. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  346. echo "    [+] get a list of the filters:     "
  347. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  348. ffmpeg -filters
  349.  
  350.  
  351.  
  352. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  353. echo "    [+] Use filters to create effects and to add text:       "
  354. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  355. ffmpeg -i $input.mp3 -filter_complex "[0:a]avectorscope=s=640x518[left]; [0:a]showspectrum=mode=separate:color=intensity:scale=cbrt:s=640x518[right]; [0:a]showwaves=s=1280x202:mode=line[bottom]; [left][right]hstack[top]; [top][bottom]vstack,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontcolor=white:x=10:y=10:text='\"Song Title\" by Artist'[out]" -map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy $output.mkv
  356.  
  357.  
  358.  
  359. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  360. echo "    [+] Show The .mp4 File's Data Streams:       "
  361. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  362. ffprobe -v error -show_format -show_streams $input.mp4
  363.  
  364.  
  365.  
  366.  
  367.  
  368. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  369. echo "    [+] Determine The Videos Frame Rate:         "
  370. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  371. ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 $input.mp4
  372.  
  373.  
  374.  
  375. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  376. echo "    [+] Determine The Videos Width x Height (resolution):            "
  377. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  378. ffprobe -v error -select_streams v:0 -show_entries stream=height,width -of csv=s=x:p=0 $input.mp4
  379.  
  380.  
  381. encode as a lower quality+resolution
  382.  
  383. ffmpeg -i $File.mp4 -c:v libvpx -c:a libvorbis -b:v 1M -crf 30 -sn -vf scale=480:360 $File.webm
  384. ffmpeg -i $File.mp4 -c:v libvpx -c:a libvorbis -b:v 1M -crf 30 -sn -vf scale=480:360 $File.webm
  385.  
  386.  
  387.  
  388.  
  389. ffmpeg -i $File.webm -c:v h264 -b:v 1M -crf 30 -sn -vf scale=720:480 $File.mp4
  390.  
  391.  
  392.  
  393.  
  394. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  395. echo "    [+] Concatenating media files:         "
  396. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  397. ffmpeg -f concat -safe 0 -i <(for f in ./*.wav; do echo "file '$PWD/$f'"; done) -c copy $output.wav
  398. ffmpeg -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" ./*.wav) -c copy $output.wav
  399. ffmpeg -f concat -safe 0 -i <(find . -name '*.wav' -printf "file '$PWD/%p'\n") -c copy $output.wav
  400.  
  401.  
  402. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  403. echo "    [+] loop input.mkv 10 times:           "
  404. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  405. for i in {1..10}; do printf "file '%s'\n" $input.mkv >> $List.txt; done
  406. ffmpeg -f concat -i $List.txt -c copy $output.mkv
  407.  
  408.  
  409.  
  410. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  411. echo "    [+] Concatenate three MPEG-2 TS files:               "
  412. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  413. echo "## --------------------------------------------------- ##"
  414. echo "    [?] And concatenates them without re-encoding:       "
  415. echo "## --------------------------------------------------- ##"
  416. ffmpeg -i "concat:$input1.ts|$input2.ts|$input3.ts" -c copy $output.ts
  417.  
  418.  
  419.  
  420. echo "##-========================================================-##"
  421. echo "## -------------------------------------------------------- ##"
  422. echo "    [?] If you have MP4 files                                 "
  423. echo "    [?] these could be losslessly concatenated                "
  424. echo "    [?] by first transcoding them to MPEG-2 transport streams."
  425. echo "    [?] With H.264 video and AAC audio:                       "
  426. echo "## -------------------------------------------------------- ##"
  427. echo "##-========================================================-##"
  428. ffmpeg -i $input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts $intermediate1.ts
  429. ffmpeg -i $input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts $intermediate2.ts
  430. ffmpeg -i "concat:$intermediate1.ts|$intermediate2.ts" -c copy -bsf:a aac_adtstoasc $output.mp4
  431.  
  432.  
  433.  
  434. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  435. echo "    [+] Concatenation of files with different codecs         "
  436. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  437. echo "## ------------------------------------------------------- ##"
  438. echo "    [?] three files that we want to concatenate              "
  439. echo "    [?] each of them with one video and audio stream         "
  440. echo "## ------------------------------------------------------- ##"
  441. ffmpeg -i $input1.mp4 -i $input2.webm -i $input3.mov -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" $output.mkv
  442.  
  443.  
  444.  
  445.  
  446.  
  447. echo "## ------------------------------------------------ ##"
  448. echo "    [?] When converting to an MP4,                    "
  449. echo "    [?] you want to use the h264 video codec          "
  450. echo "    [?] and the aac audio codec                       "
  451. echo "## ------------------------------------------------ ##"
  452. ffmpeg -i $input.mov -vcodec h264 -acodec aac -strict -2 $output.mp4
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  460. echo "    [+] input.mov is converted to output.webm          "
  461. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  462. echo "## ------------------------------------------------- ##"
  463. echo "    [?] with a constant rate factor of 10              "
  464. echo "    [?] (lower is higher quality)                      "
  465. echo "    [?] at a bitrate of 1M                             "
  466. echo "## ------------------------------------------------- ##"
  467.  
  468.  
  469.  
  470.  
  471. echo "## --------------------------------------------------------------- ##"
  472. echo "   [?] If your video does not have audio, you may leave off:         "
  473. echo "                 -->  '-acodec libvorbis'                            "
  474. echo "## --------------------------------------------------------------- ##"
  475.  
  476.  
  477.  
  478.  
  479. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  480. echo "    [+] Set the audio stream to be Vorbis:     "
  481. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  482. ffmpeg -i $input.mp3 -c:a libvorbis $File.ogg
  483.  
  484.  
  485.  
  486.  
  487. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  488. echo "    [+] Make a Matroska container:         "
  489. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  490. echo "## ----------------------------------------- ##"
  491. echo "    [?] with a VP9 video stream                "
  492. echo "    [?] and a Vorbis audio stream              "
  493. echo "## ----------------------------------------- ##"
  494. ffmpeg -i $input.mp4 -c:v vp9 -c:a libvorbis $output.mkv
  495.  
  496.  
  497.  
  498.  
  499. echo "##-========================================================-##"
  500. echo "## -------------------------------------------------------- ##"
  501. echo "   [?] The -c Flag - copies the video stream from             "
  502. echo "   [?] input.webm into output.mkv and encodes                 "
  503. echo "   [?] the Vorbis audio stream into a FLAC.                   "
  504. echo "## -------------------------------------------------------- ##"
  505. echo "##-========================================================-##"
  506. ffmpeg -i $input.webm -c:v copy -c:a flac $output.mkv
  507.  
  508.  
  509.  
  510.  
  511. echo "##-========================================================-##"
  512. echo "## -------------------------------------------------------- ##"
  513. echo "    [?] convert from one container format                     "
  514. echo "    [?] to another without having to do any                   "
  515. echo "    [?] additional stream encoding:                           "
  516. echo "## -------------------------------------------------------- ##"
  517. echo "##-========================================================-##"
  518. ffmpeg -i $input.webm -c:av copy $output.mkv
  519.  
  520.  
  521.  
  522.  
  523. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  524. echo "    [+] writing A ID3v2.3 header:        "
  525. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  526. echo "## -------------------------------------------------------- ##"
  527. echo "    [?] instead of a default ID3v2.4 to an MP3 file,          "
  528. echo "    [?] use the id3v2_version                                 "
  529. echo "    [?] private option of the MP3 muxer:                      "
  530. echo "## -------------------------------------------------------- ##"
  531. ffmpeg -i $input.flac -id3v2_version 3 $out.mp3
  532.  
  533.  
  534.  
  535.  
  536. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  537. echo "    [+] Modify The LogLevel, So Debug Info Is Printed:         "
  538. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  539. ffmpeg -loglevel repeat+level+verbose -i $File $File
  540.  
  541.  
  542.  
  543.  
  544. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  545. echo "    [+] print metadata about a video file:       "
  546. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  547. ffmpeg -i $File -f ffmetadata $metadata.txt
  548.  
  549.  
  550.  
  551.  
  552. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  553. echo "    [+] Extracting an ffmetadata file with ffmpeg goes as follows:       "
  554. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  555. ffmpeg -i $File -f ffmetadata FFMETADATAFILE
  556.  
  557.  
  558.  
  559. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  560. echo "    [+] Reinserting edited metadata information            "
  561. echo "    [?] From the FFMETADATAFILE file:                      "
  562. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  563. ffmpeg -i $File -i FFMETADATAFILE -map_metadata 1 -codec copy $File
  564.  
  565.  
  566.  
  567.  
  568. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  569. echo "    [+] Convert a .mkv to .webm:         "
  570. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  571. ffmpeg -i $input.mkv $output.webm
  572.  
  573.  
  574.  
  575. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  576. echo "    [+] A more detailed ffmpeg conversion:       "
  577. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  578. ffmpeg -i $input.mp4 -c:v libvpx-vp9 -b:v 1M -c:a libvorbis $output.webm
  579.  
  580.  
  581.  
  582.  
  583.  
  584. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  585. echo "    [+] take all data from the time specified at START.            "
  586. echo "    [?] It starts transcoding from the specified time instantly,   "
  587. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  588. ffmpeg -ss START -i "$File.mkv" $output.webm
  589. ffmpeg -i "$File.mkv" -ss START $output.webm
  590.  
  591.  
  592.  
  593.  
  594. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  595. echo "    [+] Extract a snippet of video:        "
  596. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  597. ffmpeg -ss START -t DURATION
  598. ffmpeg -ss START -to END
  599.  
  600.  
  601.  
  602.  
  603.  
  604. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  605. echo "    [+] Joining Video Files together:        "
  606. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  607. echo "## --------------------------------------- ##"
  608. echo "    [?] create a text file                   "
  609. echo "    [?] containing names of the files:       "
  610. echo "## --------------------------------------- ##"
  611. ffmpeg -f concat -i $File.txt -c copy $output.webm
  612.  
  613.  
  614.  
  615.  
  616. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  617. echo "    [+] Server side (sending):       "
  618. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  619. ffmpeg -i $File.ogg -c copy -listen 1 -f ogg http://server:port
  620.  
  621.  
  622.  
  623. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  624. echo "    [+] Client side (receiving):       "
  625. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  626. ffmpeg -i http://server:port -c copy $File.ogg
  627.  
  628.  
  629.  
  630. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  631. echo "    [+] Client can also be done with wget:       "
  632. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  633. wget http://server:port -O $File.ogg
  634.  
  635.  
  636.  
  637. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  638. echo "    [+] Server side (receiving):       "
  639. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  640. ffmpeg -listen 1 -i http://server:port -c copy $File.ogg
  641.  
  642.  
  643.  
  644. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  645. echo "    [+] Client side (sending):       "
  646. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  647. ffmpeg -i $somefile.ogg -chunked_post 0 -c copy -f ogg http://server:port
  648.  
  649.  
  650.  
  651. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  652. echo "    [+] Client can also be done with wget:       "
  653. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  654. wget --post-file=$File.ogg http://server:port
  655.  
  656.  
  657.  
  658.  
  659. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  660. echo "    [+] Convert a GIF file given inline with ffmpeg:         "
  661. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  662. ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  663.  
  664.  
  665.  
  666.  
  667. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  668. echo "    [+] Read a sequence of files         "
  669. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  670. echo "## --------------------------------------------- ##"
  671. echo "    [?] split1.mpeg, split2.mpeg, split3.mpeg      "
  672. echo "    [?] with ffplay use the command:               "
  673. echo "## --------------------------------------------- ##"
  674. ffplay concat:$split1.mpeg\|$split2.mpeg\|$split3.mpeg
  675.  
  676.  
  677.  
  678.  
  679.  
  680. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  681. echo "    [+] Create MP3 audio files (ffmpeg has no native MP3 encoder).       "
  682. echo "    [?] Encode VBR MP3 audio with ffmpeg using the libmp3lame library:   "
  683. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  684. ffmpeg -i $input.wav -codec:a libmp3lame -qscale:a 2 $output.mp3
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  697. echo "    [+] Re-encode the video and stream copy the audio.         "
  698. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  699. echo "## -------------------------------------------------------------- ##"
  700. echo "    [?] The output should be a similar quality as the input         "
  701. echo "    [?] and should be a more manageable size.                       "
  702. echo "## -------------------------------------------------------------- ##"
  703. ffmpeg -i $input.avi -c:v libx264 -preset slow -crf 18 -c:a copy -pix_fmt yuv420p $output.mkv
  704.  
  705.  
  706. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  707. echo "    [+] Re-encode the audio:       "
  708. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  709. echo "## ----------------------------------------------- ##"
  710. echo "    [?] using AAC instead of stream copying it:      "
  711. echo "## ----------------------------------------------- ##"
  712. ffmpeg -i $input.mov -c:v libx264 -preset slow -crf 18 -c:a aac -b:a 192k -pix_fmt yuv420p $File.mkv
  713.  
  714.  
  715.  
  716.  
  717.  
  718. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  719. echo "    [+] Create a video with a still image (input.png):         "
  720. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  721. echo "## ----------------------------------------------- ##"
  722. echo "    [?] And an audio file (audio.m4a):               "
  723. echo "## ----------------------------------------------- ##"
  724. ffmpeg -loop 1 -framerate 2 -i $input.png -i $audio.m4a -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p output.mkv
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  739. ##  [+] Copy metadata from the first stream of the
  740. ##      Input file To global metadata of the output file:
  741. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  742. ffmpeg -i $File.ogg -map_metadata 0:s:0 $File.mp3
  743.  
  744.  
  745. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  746. ##  [+] Copy global metadata to all audio streams:
  747. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  748. ffmpeg -i $File.mkv -map_metadata:s:a 0:g $File.mkv
  749.  
  750.  
  751.  
  752.  
  753.  
  754. ffmpeg -dump                ## Dump each input packet to stderr.
  755.  
  756. ffmpeg -hex                 ## When dumping packets, also dump the payload. (global)
  757.  
  758. -copy_unknown
  759.  
  760.  
  761.  
  762. -vstats
  763. -vstats_file $File
  764.  
  765.  
  766.  
  767.  
  768. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  769. echo "    [+] Extract the first attachment to a file named 'out.ttf':        "
  770. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  771. ffmpeg -dump_attachment:t:0 $File.ttf -i $File
  772.  
  773.  
  774. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  775. ##  [+] Extract all attachments to files determined by the "filename" tag:
  776. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  777. ffmpeg -dump_attachment:t "" -i $File
  778.  
  779.  
  780.  
  781.  
  782.  
  783. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  784. echo "    [+] Add extradata to the beginning of the filtered packets:        "
  785. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  786.  
  787. ffmpeg -i $File -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra $out.ts
  788.  
  789. ffmpeg -i $File.mp4 -codec copy -bsf:v h264_mp4toannexb $File.ts
  790.  
  791.  
  792. ffmpeg -i $File -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' $File
  793.  
  794.  
  795.  
  796. ffmpeg -i $File -c copy -bsf noise[=1] $File.mkv
  797.  
  798.  
  799.  
  800.  
  801.  
  802. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  803. ##  [+]
  804. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  805. ffmpeg -i $img.jpeg $img.png
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813. ffmpeg -i $File -f ffmetadata $FFMETADATAFILE
  814. ffmpeg -i $File -i $FFMETADATAFILE -map_metadata 1 -codec copy $OUTPUT
  815.  
  816.  
  817.  
  818.  
  819.  
  820. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  821. ##  [+] Video and Audio grabbing
  822. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  823.  
  824. ## ----------------------------------------------------- ##
  825. ##   [?] If you specify the input format and device
  826. ##       then ffmpeg can grab video and audio directly.
  827. ## ----------------------------------------------------- ##
  828. ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 $File.mpg
  829.  
  830.  
  831. ## --------------------------------------- ##
  832. ##   [?] Or with an ALSA audio source
  833. ##       (mono input, card id 1)
  834. ##           instead of OSS:
  835. ## --------------------------------------- ##
  836. ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 $File.mpg
  837.  
  838.  
  839. ffmpeg -i $File.avi -codec copy -bsf:v mpeg4_unpack_bframes $File.avi
  840.  
  841.  
  842. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  843. ##  [+] Fix an AVI file containing an MPEG-4 stream with DivX-style packed B-frames
  844. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  845. ffmpeg -i $File.avi -codec copy -bsf:v mpeg4_unpack_bframes $File.avi
  846.  
  847.  
  848.  
  849.  
  850.  
  851. ## show only audio streams, you can use the command:
  852. ffprobe -show_streams -select_streams a $File
  853.  
  854.  
  855. ## To show only video packets belonging to the video stream with index 1:
  856. ffprobe -show_packets -select_streams v:1 $File
  857.  
  858.  
  859. mjpegadump
  860. ## Add an MJPEG A header to the bitstream, to enable decoding by Quicktime.
  861.  
  862. mov2textsub
  863.  
  864. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  865. ## Extract a representable text file from MOV subtitles
  866.  
  867.  
  868. stripping the metadata header from each subtitle packet.
  869.  
  870. This bitstream filter patches the header of frames extracted from an MJPEG stream (carrying the AVI1 header ID and
  871. lacking a DHT segment) to produce fully qualified JPEG images.
  872.  
  873. ffmpeg -i $File.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  874. exiftran -i -9 frame*.jpg
  875. ffmpeg -i frame_%d.jpg -c:v copy $File.avi
  876.  
  877.  
  878.  
  879. trace_headers
  880.  
  881.  
  882. extract_extradata
  883. remove_extra all
  884.  
  885. vp9_metadata
  886.  
  887.  
  888. remove
  889.            When this option is enabled, the long-term headers are removed from the
  890.            bitstream after extraction
  891.  
  892. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  893. ##  [?] Extract the in-band extradata.
  894. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  895.  
  896. ## ------------------------------------------------------------------- ##
  897. ##  [?] Certain codecs allow the long-term headers
  898. ##      (e.g. MPEG-2 sequence headers, or H.264/HEVC (VPS/)SPS/PPS)
  899. ## ------------------------------------------------------------------- ##
  900. ##      to be transmitted either "in-band"
  901. ##      (as a part of the bitstream containing the coded frames)
  902. ## ------------------------------------------------------------------- ##
  903. ##      or "out of band" (on the container level).
  904. ##      This latter form is called "extradata" in FFmpeg
  905. ## ------------------------------------------------------------------- ##
  906.  
  907.  
  908.  
  909. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  910. ##  [+] Remove zero padding at the end of a packet.
  911. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  912. chomp
  913.  
  914.  
  915.  
  916.  
  917.  
  918. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  919. ##  [+] Extract the core from a DCA/DTS stream
  920. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  921. ## ----------------------------------------------- ##
  922. ##   [?] Dropping extensions such as DTS-HD.
  923. ## ----------------------------------------------- ##
  924. dca_core
  925.  
  926.  
  927.  
  928.  
  929. dump_extra
  930.  
  931. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  932. ##  [+] Add extradata to the beginning of the filtered packets.
  933. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  934.  
  935. ## ----------------------------------------------------------------------------- ##
  936. ##   [?] The additional argument specifies which packets should be filtered.
  937. ## ----------------------------------------------------------------------------- ##
  938.  
  939. ## ------------------------------------------------- ##
  940. ## a        [+] Add extradata to all key packets,
  941. ##              but only if local_header is set
  942. ##              in the flags2 codec context field
  943. ## ------------------------------------------------- ##
  944. ## k        [+] Add extradata to all key packets
  945. ## ------------------------------------------------- ##
  946. ## e        [+] Add extradata to all packets
  947. ## ------------------------------------------------- ##
  948.  
  949.  
  950.  
  951. ##-====================================================================================-##
  952. ##                  (If not specified it is assumed k)
  953. ##-====================================================================================-##
  954.  
  955.  
  956. ## ------------------------------------------------------------------- ##
  957. ##   [?] Forces a global header
  958. ## ------------------------------------------------------------------- ##
  959. ##   [?] Disabling individual packet headers in the H.264 packets
  960. ## ------------------------------------------------------------------- ##
  961. ##   [?] Generated by the "libx264" encoder
  962. ## ------------------------------------------------------------------- ##
  963. ##   [?] But its corrected by adding the header
  964. ##       stored in extradata to the key packets:
  965. ## ------------------------------------------------------------------- ##
  966. ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981. ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  982.  
  983.  
  984.  
  985. ffplay -f video4linux2 -list_formats all /dev/video0
  986. ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
  987.  
  988.  
  989. ffplay -i input -vf histogram
  990.  
  991.  
  992.  
  993. ffplay -dumpgraph 1 -f lavfi
  994.  
  995.  
  996. ffplay -report
  997. ffplay -loglevel verbose
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  1007. echo "    [+] Read A Rawvideo File $input.raw With ffplay:           "
  1008. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  1009. echo "## --------------------------------------------------------- ##"
  1010. echo "    [?] Assuming A Pixel Format of rgb24                       "
  1011. echo "    [?] A Video Size of 320x240                                "
  1012. echo "    [?] And A Frame Rate of 10 Images Per Second               "
  1013. echo "## --------------------------------------------------------- ##"
  1014. ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 $input.raw
  1015.  
  1016.  
  1017.  
  1018.  
  1019. echo "##-=========================================-##"
  1020. echo "## ----------------------------------------- ##"
  1021. echo "    [?] With The Overlay Filter,               "
  1022. echo "    [+] Place An Infinitely Looping GIF        "
  1023. echo "    [?] Over Another Video:                    "
  1024. echo "## ----------------------------------------- ##"
  1025. echo "##-=========================================-##"
  1026. ffmpeg -i $input.mp4 -ignore_loop 0 -i $input.gif -filter_complex overlay=shortest=1 $out.mkv
  1027.  
  1028.  
  1029.  
  1030.  
  1031. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  1032. echo "    [+] Extract the first attachment to a file named 'out.ttf':        "
  1033. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  1034. ffmpeg -dump_attachment:t:0 $out.ttf -i INPUT
  1035.  
  1036.  
  1037.  
  1038. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  1039. echo "    [+] Extract all attachments to files determined by the "filename" tag:       "
  1040. echo "##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##"
  1041. ffmpeg -dump_attachment:t "" -i INPUT
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049. ffmpeg -vstats                  ## Dump video coding statistics to vstats_HHMMSS.log.
  1050. ffmpeg -vstats_file $file       ## Dump video coding statistics to file.
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. ffmpeg -f flv -i $myfile.flv ...
  1061. ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
  1062.  
  1063. -flv_metadata bool              ## Allocate the streams according to the onMetaData array content.
  1064. -flv_ignore_prevtag bool        ## Ignore the size of previous tag value.
  1065. -flv_full_metadata bool         ## Output all context of the onMetadata.
  1066.  
  1067.  
  1068.  
  1069.  
  1070. ffmpeg -f flv -i $file.flv
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077. ffmpeg -minrate -i $input.flac -id3v2_version 3 $out.mp3
  1078.  
  1079.  
  1080. ffmpeg -minrate -i $File.mp4 $File.mp3      ## Minimal bitrate allowed in vbr/2pass mode    
  1081. ffmpeg -maxrate                             ## Maxium bitrate allowed in vbr/2pass mode
  1082.  
  1083.  
  1084.  
  1085. Two-Pass Encoding
  1086.  
  1087. ffmpeg -y -i input -c:v libx265 -b:v 2600k -x265-params pass=1 -an -f mp4 /dev/null && \
  1088. ffmpeg -i input -c:v libx265 -b:v 2600k -x265-params pass=2 -c:a aac -b:a 128k $output.mp4
  1089.  
  1090.  
  1091.  
  1092.  
  1093. Constant Rate Factor (CRF)
  1094.  
  1095. ffmpeg -i input -c:v libx265 -crf 28 -c:a aac -b:a 128k $output.mp4
  1096.  
  1097.  
  1098.  
  1099.  
  1100. encodes a video with good quality, using slower preset to achieve better compression:
  1101.  
  1102. ffmpeg -i $input.avi -c:v libx264 -preset slow -crf 22 -c:a copy $output.mkv
  1103.  
  1104.  
  1105.  
  1106.  
  1107. ## Fast encoding example:
  1108. ffmpeg -i input -c:v libx264 -preset ultrafast -crf 0 $output.mkv
  1109.  
  1110.  
  1111. ## Best compression example:
  1112. ffmpeg -i input -c:v libx264 -preset veryslow -crf 0 $output.mkv
  1113.  
  1114.  
  1115.  
  1116.  
  1117. list recording cards or devices:
  1118. arecord -l
  1119. arecord -L
  1120.  
  1121.  
  1122. ## Capturing audio with ffmpeg and ALSA
  1123. ffmpeg -f alsa <input_options> -i <input_device> ... $output.wav
  1124. ffmpeg -f alsa -i default:CARD=U0x46d0x809 -t 30 $out.wav
  1125.  
  1126. ## 30 seconds WAV audio output,
  1127. ## recorded from our USB camera's
  1128. ## default recording device (microphone).
  1129. ffmpeg -f alsa -i hw:1 -t 30 $out.wav
  1130. ffmpeg -f alsa -i hw:0,2 -t 30 $out.wav
  1131.  
  1132.  
  1133. ## Record audio from an application ¶
  1134.  
  1135. ## Record audio from an application
  1136. ## Load the snd_aloop module:
  1137. modprobe snd-aloop pcm_substreams=1
  1138.  
  1139. ## Set the default ALSA audio output
  1140. ## to one substream of the Loopback device
  1141. ## in your .asoundrc (or /etc/asound.conf)
  1142.  
  1143.  
  1144. ## Edit The .asoundrc File:
  1145. pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }
  1146.  
  1147.  
  1148. ## You can now record audio from a running application using:
  1149. ffmpeg -f alsa -ac 2 -ar 44100 -i hw:Loopback,1,0 $out.wav
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155. ##-=======================================================-##
  1156. ##   [+]  Convert  mp4/ffmpeg
  1157.  
  1158. ffmpeg -i myvideo.mp4 -vcodec copy -an myvideo_video.mp4
  1159. ffmpeg -i myvideo.mp4 -acodec copy -vn myvideo_audio.m4a
  1160.  
  1161. ##-=======================================================-##
  1162. ##   [+]  Convert  webm/ffmpeg
  1163.  
  1164. ffmpeg -i $video.webm -vcodec copy -an $video.webm
  1165. ffmpeg -i $video.webm -acodec copy -vn $audio.webm
  1166.  
  1167.  
  1168. ##-================================-##
  1169. ##   [+]  Convert  MP3 --> OGG
  1170. ##-================================-##
  1171. ffmpeg -i $input.mp3 $output.ogg
  1172.  
  1173. ##-============================================-##
  1174. ##   [+] Change characteristics --> Bitrate
  1175. ##-============================================-##
  1176.  
  1177. ## -------------------------------------------------------- ##
  1178. ##   [?] You can do this when converting to mp4 or webm.
  1179. ## -------------------------------------------------------- ##
  1180. ffmpeg -i $video.mov -b:v 350K $video.mp4
  1181. ffmpeg -i $video.mov -vf setsar=1:1 -b:v 350K $video.webm
  1182.  
  1183.  
  1184.  
  1185. ##-=============================-##
  1186. ##   [+] Convert MOV --> MP4
  1187. ##-=============================-##
  1188. ffmpeg -i $video.mov $video.mp4
  1189.  
  1190.  
  1191. When converting a file to webm,
  1192. ffmpeg doesnt provide the correct aspect ratio.
  1193. Fix this with a filter (-vf setsar=1:1).
  1194.  
  1195. ffmpeg -i $video.mov -vf setsar=1:1 $video.webm
  1196.  
  1197.  
  1198.  
  1199. ##-=======================================================-##
  1200. ##   [+] Resolution
  1201.  
  1202. ffmpeg -i $video.webm -s 1920x1080 $video_1920x1080.webm      ## set frame size (WxH or abbreviation)
  1203.  
  1204.  
  1205.  
  1206.  
  1207. ffmpeg -i $video.$ext -metadata string=$String
  1208.  
  1209.  
  1210. ##-===============================================-##
  1211. ##   [+] Setting the title in the output file:
  1212. ##-===============================================-##
  1213. ffmpeg -i $in.avi -metadata title="my title" $out.flv
  1214.  
  1215.  
  1216.  
  1217.  
  1218. ## ---------------------------------------------------------------------- ##
  1219. ##   [?] For Matroska you also have to set the mimetype metadata tag:
  1220. ## ---------------------------------------------------------------------- ##
  1221. ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv
  1222.  
  1223.  
  1224.  
  1225.  
  1226. ##-============================================================================-##
  1227. ##   [+] Extract all attachments to files determined by the "filename" tag:
  1228. ##-============================================================================-##
  1229. ffmpeg -dump_attachment:t "" -i INPUT
  1230.  
  1231.  
  1232.  
  1233. ##-=======================================================-##
  1234. ##   [+] Create 5 copies of the input audio with ffmpeg:
  1235. ##-=======================================================-##
  1236. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  1237.  
  1238.  
  1239.  
  1240. ffprobe -i $File.webm -show_streams
  1241. ffprobe -i $File.webm -show_streams | grep (width|height)
  1242.  
  1243. ffprobe -i jones.webm -show_streams | grep width
  1244. ffprobe -i jones.webm -show_streams | grep height
  1245.  
  1246.  
  1247.  
  1248. -dn                 ## disable data
  1249.  
  1250. -seek_timestamp             ## enable/disable seeking by timestamp with -ss
  1251. -timestamp time             ## set the recording timestamp ('now' to set the current time)
  1252. -metadata string=string     ## add metadata
  1253.  
  1254.  
  1255. -map_metadata outfile[,metadata]:infile[,metadata]      ## set metadata information of outfile from infile
  1256.  
  1257.  
  1258. -stats              ## print progress report during encoding
  1259. -ignore_unknown     ## Ignore unknown stream types
  1260. -report             ## generate a report
  1261. -loglevel
  1262. -sources device     ## list sources of the input device
  1263.  
  1264. -buildconf          ## show build configuration
  1265. -formats            ## show available formats
  1266. -muxers             ## show available muxers
  1267. -demuxers           ## show available demuxers
  1268. -devices            ## show available devices
  1269. -codecs             ## show available codecs
  1270. -decoders           ## show available decoders
  1271. -encoders           ## show available encoders
  1272. -bsfs               ## show available bit stream filters
  1273. -protocols          ## show available protocols
  1274. -filters            ## show available filters
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281. icecast://[username[:password]@]server:port/mountpoint
  1282.  
  1283.  
  1284.  
  1285.  
  1286. ##-=============================================================================-##
  1287. ##   [+] write an ID3v2.3 header instead of a default ID3v2.4 to an MP3 file
  1288. ##-=============================================================================-##
  1289.  
  1290.  
  1291. ## ----------------------------------------------------------------- ##
  1292. ##   [?] Use the id3v2_version private option of the MP3 muxer:
  1293. ## ----------------------------------------------------------------- ##
  1294. ffmpeg -i input.flac -id3v2_version 3 out.mp3
  1295.  
  1296.  
  1297. ##-================================-##
  1298. ##   [+] Show only audio streams
  1299. ##-================================-##
  1300. ffprobe -show_streams -select_streams a INPUT
  1301.  
  1302.  
  1303.  
  1304. ##-============================================================================-##
  1305. ##   [+] Show only video packets belonging to the video stream with index 1:
  1306. ##-============================================================================-##
  1307. ffprobe -show_packets -select_streams v:1 INPUT
  1308. ffprobe -show_packets -select_streams v:1 -i jones.webm
  1309.  
  1310. codec_name
  1311. width
  1312. height
  1313. duration
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319. ##-=======================================================-##
  1320. ##   [+] Read a sequence of files:
  1321. ##       split1.mpeg, split2.mpeg, split3.mpeg
  1322. ##       with ffplay:
  1323. ##-=======================================================-##
  1324. ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331. ##-=========================================-##
  1332. ##   [+] Enables experimental HTTP server
  1333. ##-=========================================-##
  1334.  
  1335.  
  1336. ## --------------------------------------------------------------- ##
  1337. ##   [?] This can be used to send data when used as an output
  1338. ##       option, or read data from a client with HTTP POST
  1339. ##       when used as an input option.  If set to 2 enables
  1340. ##       experimental multi-client HTTP server.
  1341. ## --------------------------------------------------------------- ##
  1342.  
  1343. ##-===============================-##
  1344. ##   [+] Server side (sending):
  1345. ##-===============================-##
  1346. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://<server>:<port>
  1347.  
  1348. ##-=================================-##
  1349. ##   [+] Client side (receiving):
  1350. ##-=================================-##
  1351. ffmpeg -i http://<server>:<port> -c copy somefile.ogg
  1352.  
  1353. ##-===========================================-##
  1354. ##   [+] Client can also be done with wget:
  1355. ##-===========================================-##
  1356. wget http://<server>:<port> -O somefile.ogg
  1357.  
  1358. ##-================================-##
  1359. ##   [+] Server side (receiving):
  1360. ##-================================-##
  1361. ffmpeg -listen 1 -i http://<server>:<port> -c copy somefile.ogg
  1362.  
  1363. ##-===============================-##
  1364. ##   [+] Client side (sending):
  1365. ##-===============================-##
  1366. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://<server>:<port>
  1367.  
  1368. ##-============================================-##
  1369. ##   [+] Client can also be done with wget:
  1370. ##-============================================-##
  1371. wget --post-file=somefile.ogg http://<server>:<port>
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377. ##-======================-##
  1378. ##   [+] HTTP Cookies
  1379. ##-======================-##
  1380. ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386. ice_url
  1387. ice_name
  1388. user_agent
  1389. password
  1390.  
  1391.  
  1392. icecast://[<username>[:<password>]@]<server>:<port>/<mountpoint>
  1393.  
  1394.  
  1395.  
  1396.  
  1397. ##-===============================================================================-##
  1398. ##   [+] Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  1399. ##-===============================================================================-##
  1400. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  1401.  
  1402.  
  1403.  
  1404. ##-===============================================================-##
  1405. ##   [+] Write the MD5 hash of the encoded AVI file to stdout.
  1406. ##-===============================================================-##
  1407. ffmpeg -i input.flv -f avi -y md5:
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414. ## --------------------------------------------------------------------- ##
  1415. ##   [?] Read from or write to remote resources using SFTP protocol
  1416. ## --------------------------------------------------------------------- ##
  1417.  
  1418. sftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
  1419.  
  1420.  
  1421. ##-===============================================-##
  1422. ##   [+] Define Your SSH Private Keys Location:
  1423. ##-===============================================-##
  1424. private_key ~/.ssh/
  1425.  
  1426.  
  1427. ##-==============================================-##
  1428. ##   [+] Play a file stored on remote server:
  1429. ##-==============================================-##
  1430. ffplay sftp://user:password@server_address:22/home/user/resource.mpeg
  1431.  
  1432.  
  1433.  
  1434. ##-======================================================================-##
  1435. ##   [+] Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  1436. ##-======================================================================-##
  1437.  
  1438. ## -------------------------------------------------- ##
  1439. ##   [?] The required syntax for a TLS/SSL url is:
  1440. ## -------------------------------------------------- ##
  1441.  
  1442.  
  1443.  
  1444. tls://<hostname>:<port>[?<options>]
  1445.  
  1446.                         ##-=======================================================-##
  1447.                         ##   [+]
  1448.                         ##-=======================================================-##
  1449. cafile=                 ## [+] A file containing certificate authority (CA)
  1450.                         ##     root certificates to treat as trusted.
  1451.                         ##-=======================================================-##
  1452.                        
  1453.                         ##-=======================================================-##
  1454. tls_verify=1            ##   [+] Verify the peer that we are communicating with
  1455.                         ##-=======================================================-##
  1456. cert=                   ## A file containing a certificate to use in the handshake with the peer.
  1457.                         ##-=================================================-##
  1458.                        
  1459.                         ## ------------------------------------------------- ##
  1460.                         ##   [?] When operating as server, in listen mode
  1461.                         ##       this is more often required by the peer
  1462.                         ## ------------------------------------------------- ##
  1463.  
  1464.                
  1465.  
  1466.                         ## -------------------------------------------------------------- ##
  1467. key=                    ##   [?] A file containing the private key for the certificate
  1468.                         ## -------------------------------------------------------------- ##
  1469.  
  1470.  
  1471.  
  1472. listen=1                ## Server Role
  1473. listen=0                ## Client Role
  1474.  
  1475. ## ---------------------------------------------------------------- ##
  1476. ##   [?] If enabled, listen for connections on the provided port,
  1477. ##       Assume the server role,
  1478. ##       (in the handshake) instead of the client role.
  1479. ## ---------------------------------------------------------------- ##
  1480.  
  1481.  
  1482.  
  1483.  
  1484. create a TLS/SSL server that serves an input stream.
  1485.  
  1486. ffmpeg -i <input> -f <format> tls://<hostname>:<port>?listen&cert=<server.crt>&key=<server.key>
  1487.  
  1488.  
  1489.  
  1490.  
  1491. play back a stream from the TLS/SSL server using ffplay:
  1492.  
  1493. ffplay tls://<hostname>:<port>
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500. ##-=======================================-##
  1501. ##   [+] read from stdin with ffmpeg:
  1502. ##-=======================================-##
  1503. cat test.wav | ffmpeg -i pipe:0
  1504. # ...this is the same as...
  1505. cat test.wav | ffmpeg -i pipe:
  1506.  
  1507.  
  1508. ##-=======================================-##
  1509. ##   [+] writing to stdout with ffmpeg:
  1510. ##-=======================================-##
  1511. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  1512. # ...this is the same as...
  1513. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  1514.  
  1515.  
  1516.  
  1517.  
  1518. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1519. ##  [+] Create a color video stream and play it back with ffplay:
  1520. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1521. ffplay -f lavfi -graph "color=c=pink [out0]" dummy
  1522.  
  1523. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1524. ##  [+] As the previous example, but use filename for specifying
  1525. ##      the graph description, and omit the "out0" label:
  1526. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1527. ffplay -f lavfi color=c=pink
  1528.  
  1529.  
  1530. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1531. ##  [+] Create three different video test filtered sources and play them:
  1532. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1533. ffplay -f lavfi -graph "testsrc [out0]; testsrc,hflip [out1]; testsrc,negate [out2]" test3
  1534.  
  1535.  
  1536. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1537. ##  [+] Read an audio stream from a file using the amovie source
  1538. ##      and play it back with ffplay:
  1539. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1540. ffplay -f lavfi "amovie=test.wav"
  1541.  
  1542. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1543. ##  [+] Read an audio stream and a video stream and play it back with ffplay:
  1544. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1545. ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
  1546.  
  1547. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1548. ##  [+] Dump decoded frames to images and closed captions to a file (experimental):
  1549. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1550. ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1560. ##  [+] Print the list of OpenAL supported devices and exit:
  1561. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1562. ffmpeg -list_devices true -f openal -i dummy out.ogg
  1563.  
  1564.  
  1565. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1566. ##  [+] Capture from the OpenAL device DR-BT101 via PulseAudio:
  1567. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1568. ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
  1569.  
  1570.  
  1571. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1572. ##  [+] Capture from the default device (note the empty string '' as filename):
  1573. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1574. ffmpeg -f openal -i '' out.ogg
  1575.  
  1576.  
  1577. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1578. ##  [+] Capture from two devices simultaneously,
  1579. ##       writing to two different files
  1580. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1581. ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
  1582.  
  1583.  
  1584. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1585. List supported formats for a video4linux2 device:
  1586. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1587. ffplay -f video4linux2 -list_formats all /dev/video0
  1588.  
  1589.  
  1590. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1591. ##  [+] Grab and show the input of a video4linux2 device:
  1592. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1593. ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
  1594.  
  1595.  
  1596. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1597. ##  [+] Grab and record the input of a video4linux2 device,
  1598. ##      leave the frame rate and size as previously set:
  1599. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1600. ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
  1601.  
  1602.  
  1603. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1604. ##  [+] grab from :0.0 using ffmpeg:
  1605. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1606. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg
  1607.  
  1608. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1609. ##  [+] Grab at position "10,20":
  1610. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1611. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 $File.mpg
  1612.  
  1613. ffmpeg -f x11grab -follow_mouse centered -framerate 25 -video_size cif -i :0.0 $File.mpg
  1614.  
  1615.  
  1616.  
  1617. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1618. ##  [+] Follow only when the mouse pointer reaches within 100 pixels to edge:
  1619. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1620. ffmpeg -f x11grab -follow_mouse 100 -framerate 25 -video_size cif -i :0.0 $File.mpg
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1629. ##  [+] Output the duration of a video
  1630.  
  1631. ffprobe -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 $File.ext
  1632.  
  1633. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1634. ##  [+] Output stream information as JSON
  1635.  
  1636. ffprobe -v quiet -print_format json -show_format -show_streams $File.ext
  1637.  
  1638. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1639. ##  [+] Create a screen of the video every X frames
  1640.  
  1641. ffmpeg -i $File.ext -an -s 319x180 -vf fps=1/100 -qscale:v 75 %03d.jpg
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647. ffprobe -v error -select_streams v:0 -show_entries stream=width,height,duration,bit_rate -of default=noprint_wrappers=1 $File.mp4
  1648.  
  1649. ffprobe -v error -select_streams v:0 -show_format $File.webm
  1650.  
  1651. ffprobe -v error -select_streams v:0 -show_streams $File.webm
  1652.  
  1653. duration_ts=N/A
  1654. duration=N/A
  1655. bit_rate=N/A
  1656. max_bit_rate
  1657. avg_frame_rate
  1658. width=320
  1659. height=
  1660. codec_name
  1661.  
  1662. -protocol_blacklist
  1663. -protocol_whitelist
  1664.  
  1665. -show_error
  1666. -show_data
  1667. -show_data_hash
  1668. -show_format
  1669. -show_frames
  1670. -show_log
  1671. -show_packets
  1672. -show_streams
  1673. -count_frames
  1674. -count_packets
  1675. -show_private_data
  1676.  
  1677. -find_stream_info
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690. -list_formats all
  1691.  
  1692.  
  1693.  
  1694. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1695. ##  [+] Record a stream from default device:
  1696.  
  1697. ffmpeg -f pulse -i default /tmp/pulse.wav
  1698.  
  1699.  
  1700.  
  1701. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1702. ##  [+] copy with ffmpeg the entire Audio-CD in /dev/sr0, you may run the command:
  1703.  
  1704. ffmpeg -f libcdio -i /dev/sr0 cd.wav
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1712. ##   [+] Print the list of AVFoundation supported devices and exit:
  1713. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1714. ffmpeg -f avfoundation -list_devices true -i ""
  1715.  
  1716. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1717. ##   [+] Record video from video device 0
  1718. ##   [+] and audio from audio device 0 into out.avi:
  1719. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1720. ffmpeg -f avfoundation -i "0:0" out.avi
  1721.  
  1722. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1723. ##   [+] Record video from video device 2
  1724. ##   [+] and audio from audio device 1 into out.avi:
  1725. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1726. ffmpeg -f avfoundation -video_device_index 2 -i ":1" out.avi
  1727.  
  1728. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1729. ##   [+] Record video from the system default video device
  1730. ##   [+] using the pixel format bgr0
  1731. ##   [+] Dont record any audio into out.avi:
  1732. ##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-##
  1733. ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740. ## extract mkv subtitles"
  1741.  
  1742. for f in *.mkv; do ffmpeg -y -i \"$f\" -map 0:m:language:eng -map -0:a -map -0:v \"${f%.*}.en.srt\"; done;
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748. convert mkv to apple tv compatible mp4
  1749. ffmpeg -i INPUT.mkv -map 0:v:0  -c:v copy -map 0:a:0  -c:a libfdk_aac -b:a 160k  -ac 2 -vtag hvc1 -y output.mp4
  1750.  
  1751.  
  1752.  
  1753. convert x265 to mp4 for quicktime compatability.  use dolby eac3 for multistream audio support"
  1754. ffmpeg -i INPUT.mkv -map 0:v:0  -c:v copy -map 0:a:0  -c:a eac3 -vtag hvc1 -y output.mp4
  1755.  
  1756.  
  1757. ## ffmpeg: cut 15 seconds from the start and 30 seconds from the end for every mkv video file in a folder.  (ffmpeg doesnt have an simple \N seconds from end\ param)
  1758. for f in ./*.mkv; do ffmpeg -i \"$f\" -ss 00:00:15 -to  $(( $(ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1 $f) - 30 )) -c copy  \"parts/${f%.*}-part.mkv\"; done
  1759.  
  1760.  
  1761.  
  1762. ##  ffmpeg: concat all `*part*.mkv` video files into one big video file.
  1763. ##  Very fast. No transcoding, but videos must have compataible encodings to begin with.  
  1764. ##  Subtitles get combined just fine.  ffmpegs conact takes the list of files in a weird way so thats generated on the fly.
  1765. ffmpeg -safe 0 -f concat -i  <(for f in *part*.mkv;  do echo file \"$(pwd)/$f\"; done) -c copy ./all-video-parts-combined.mkv
  1766.  
  1767.  
  1768. ##  side by side video and spectrum of its audio https://video.stackexchange.com/questions/23222/ffplay-is-there-a-way-to-display-a-video-and-spectrogram-in-the-same-output
  1769. ffplay -f lavfi 'amovie=sweet-video.mkv:s=dv+da[v][a];[a]asplit[asp][out1];[asp]showspectrum=size=660x427:mode=separate:slide=scroll[spect]; [v]scale=640:-1[v];[v][spect]hstack[out0]'
  1770.  
  1771.  
  1772. ##  record webcam and microphone with ffmpeg.  Real world timestamp overlaid. Tuned for very low cpu usage and moderate file size/quality good for making a day-line recording of yourself.  (12 hours = 10GB).  hevc_videotoolbox is the key to making it very low cpu.  If you drop the microphone recording the CPU goes down by 50%... it's is a bit dumb though, so the bitrate is still rather high.  0.6M instead of 1.2MBits would make it roughly half as big and okay quality (except when there's motion/light changes).
  1773. ffmpeg   -f avfoundation  -framerate 15 -s \"800x600\" -i \"0:3\"  -vf \"settb=AVTB,setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)',drawtext=text='%{localtime}.%{eif\\:1M*t-1K*trunc(t*1K)\\:d}'\"  -c:v hevc_videotoolbox  -realtime 1 -c:a libopus -compression_level 0 -application lowdelay -ac 1 -b:a 32k -b:v 1.2M -tune zerolatency -preset ultrafast  -threads 1 -y /tmp/webcam.mkv
  1774.  
  1775. ##  record screen capture, webcam, and loopback audio into one file.  Needs lots of tweaking.  Probably use the hardware encoders
  1776. ffmpeg -f avfoundation -i \"2:3\" -f avfoundation -framerate 24 -s \"1280x720\" -i \"0\" -filter_complex \"[0:v]scale=1280:-1[scd];[scd][1:v]vstack\"   ~/Downloads/media/live2.mkv
  1777.  
  1778. ##  ffmpeg/ffprobe: print timestamp of every frame from first 5 mins, then us awk to filter for key frames only (K)
  1779. ffprobe -loglevel error -select_streams v:0 -read_intervals '%05:00' -show_entries packet=pts_time,flags -of csv=print_section=0 input.mkv | awk -F',' '/K/ {print $1}'
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791. ffmpeg -f avfoundation -list_devices true -i ""
  1792. ffmpeg -f avfoundation -i "0:0" out.avi
  1793. ffmpeg -f avfoundation -video_device_index 2 -i ":1" out.avi
  1794. ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi
  1795. ffmpeg -list_devices true -f dshow -i dummy
  1796. ffmpeg -f dshow -i video="Camera"
  1797. ffmpeg -f dshow -video_device_number 1 -i video="Camera"
  1798. ffmpeg -f dshow -i video="Camera":audio="Microphone"
  1799. ffmpeg -list_options true -f dshow -i video="Camera"
  1800. ffmpeg -f dshow -audio_pin_name "Audio Out" -video_pin_name 2 -i video=video="@device_pnp_\\?\pci#ven_1a0a&dev_6200&subsys_62021461&rev_01#4&e2c7dd6&0&00e1#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{ca465100-deb0-4d59-818f-8c477184adf6}":audio="Microphone"
  1801. ffmpeg -f dshow -show_video_device_dialog true -crossbar_video_input_pin_number 0
  1802.  
  1803.  
  1804. ffmpeg -sources pulse,server=192.168.0.4
  1805. ffmpeg -sinks pulse,server=192.168.0.4
  1806. ffmpeg -cpuflags -sse+mmx ...
  1807. ffmpeg -cpuflags mmx ...
  1808. ffmpeg -cpuflags 0 ...
  1809. ffmpeg -opencl_bench
  1810. ffmpeg -opencl_options platform_idx=<pidx>:device_idx=<didx> ...
  1811. ffmpeg -i input.flac -id3v2_version 3 out.mp3
  1812. ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
  1813. ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
  1814. ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
  1815. ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts
  1816. ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
  1817. ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  1818. ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  1819. ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
  1820. ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
  1821. ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
  1822. ffmpeg -f flv -i myfile.flv ...
  1823. ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
  1824. ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
  1825. ffmpeg -i img.jpeg img.png
  1826. ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
  1827. ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
  1828. ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
  1829. ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
  1830. ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
  1831. ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
  1832. ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  1833. ffmpeg -i file:input.mpeg output.mpeg
  1834. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://<server>:<port>
  1835. ffmpeg -i http://<server>:<port> -c copy somefile.ogg
  1836. ffmpeg -listen 1 -i http://<server>:<port> -c copy somefile.ogg
  1837. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://<server>:<port>
  1838. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  1839. ffmpeg -i input.flv -f avi -y md5:
  1840. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  1841. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  1842. ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@myserver/
  1843. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  1844. ffmpeg -re -i <input> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  1845. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp <output>
  1846. ffmpeg -re -i <input> -f sap sap://224.0.0.255?same_port=1
  1847. ffmpeg -re -i <input> -f sap sap://224.0.0.255
  1848. ffmpeg -re -i <input> -f sap sap://[ff0e::1:2:3:4]
  1849. ffmpeg -i <input> -f <format> tcp://<hostname>:<port>?listen
  1850. ffmpeg -i <input> -f <format> tls://<hostname>:<port>?listen&cert=<server.crt>&key=<server.key>
  1851. ffmpeg -i <input> -f <format> udp://<hostname>:<port>
  1852. ffmpeg -i <input> -f mpegts udp://<hostname>:<port>?pkt_size=188&buffer_size=65535
  1853. ffmpeg -i udp://[<multicast-address>]:<port> ...
  1854. ffmpeg -f alsa -i hw:0 alsaout.wav
  1855. ffmpeg -f decklink -list_devices 1 -i dummy
  1856. ffmpeg -f decklink -list_formats 1 -i 'Intensity Pro'
  1857. ffmpeg -format_code Hi50 -f decklink -i 'Intensity Pro' -c:a copy -c:v copy output.avi
  1858. ffmpeg -bm_v210 1 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -c:a copy -c:v copy output.avi
  1859. ffmpeg -channels 16 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -c:a copy -c:v copy output.avi
  1860. ffmpeg -f kmsgrab -i - -vf 'hwdownload,format=bgr0' output.mp4
  1861. ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi output.mp4
  1862. ffmpeg -f libndi_newtek -find_sources 1 -i dummy
  1863. ffmpeg -f libndi_newtek -i "DEV-5.INTERNAL.M1STEREO.TV (NDI_SOURCE_NAME_1)" -f libndi_newtek -y NDI_SOURCE_NAME_2
  1864. ffmpeg -f fbdev -framerate 10 -i /dev/fb0 out.avi
  1865. ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
  1866. ffmpeg -f gdigrab -framerate 6 -i desktop out.mpg
  1867. ffmpeg -f gdigrab -framerate 6 -offset_x 10 -offset_y 20 -video_size vga -i desktop out.mpg
  1868. ffmpeg -f gdigrab -framerate 6 -i title=Calculator out.mpg
  1869. ffmpeg -f gdigrab -show_region 1 -framerate 6 -video_size cif -offset_x 10 -offset_y 20 -i desktop out.mpg
  1870. ffmpeg -f iec61883 -i auto -hdvbuffer 100000 out.mpg
  1871. ffmpeg:input_1
  1872. ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
  1873. ffmpeg -f libcdio -i /dev/sr0 cd.wav
  1874. ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
  1875. ffmpeg -f pulse -i default /tmp/pulse.wav
  1876. ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
  1877. ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
  1878. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg
  1879. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
  1880. ffmpeg -f x11grab -follow_mouse centered -framerate 25 -video_size cif -i :0.0 out.mpg
  1881. ffmpeg -f x11grab -follow_mouse 100 -framerate 25 -video_size cif -i :0.0 out.mpg
  1882. ffmpeg -f x11grab -show_region 1 -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
  1883. ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_size cif -i :0.0 out.mpg
  1884. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  1885. ffmpeg -i infile -vf scale=640:360 outfile
  1886. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  1887. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  1888. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1889. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1890. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1891. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1892. ffmpeg -i INPUT -af atrim=60:120
  1893. ffmpeg -i INPUT -af atrim=end_sample=1000
  1894. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1895. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1896. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1897. ffmpeg -i in.wav -filter_complex
  1898. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  1899. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  1900. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  1901. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  1902. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1903. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1904. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  1905. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1906. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1907. ffmpeg -i input.png -vf chromakey=green out.png
  1908. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  1909. ffmpeg -i input.png -vf colorkey=green out.png
  1910. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  1911. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@inputMessage=https\\\\\://FFmpeg.org/@inputCorrectionLevel=H -frames:v 1 QRCode.png
  1912. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  1913. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  1914. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  1915. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  1916. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  1917. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  1918. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  1919. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  1920. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  1921. ffmpeg -f lavfi -i B<haldclutsrc>=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  1922. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  1923. ffmpeg -f lavfi -i B<haldclutsrc>=8 -vf "
  1924. ffmpeg -i in.avi -vf "hflip" out.avi
  1925. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  1926. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  1927. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  1928. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  1929. ffmpeg -i left.avi -i right.avi -filter_complex "
  1930. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  1931. ffmpeg -i input.mkv -vf palettegen palette.png
  1932. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  1933. ffmpeg -i input -vf pullup -r 24000/1001 ...
  1934. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--}:x=(w-tw)/2:y=400-ascent'
  1935. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  1936. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  1937. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  1938. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  1939. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  1940. ffmpeg -i main.mpg -i ref.mpg -lavfi  "ssim;[0:v][1:v]psnr" -f null -
  1941. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  1942. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  1943. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  1944. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  1945. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  1946. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  1947. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  1948. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  1949. ffmpeg -i INPUT -vf trim=60:120
  1950. ffmpeg -i INPUT -vf trim=duration=1
  1951. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  1952. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  1953. ffmpeg -i in.avi -vf "vflip" out.avi
  1954. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  1955. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@inputMessage=https\\\\\://FFmpeg.org/@inputCorrectionLevel=H -frames:v 1 QRCode.png
  1956. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  1957. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  1958. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  1959. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  1960. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  1961. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  1962. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  1963. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  1964. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  1965. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  1966. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980. ffmpeg -sources pulse,server=192.168.0.4
  1981. ffmpeg -sinks pulse,server=192.168.0.4
  1982.  
  1983. ##  output a report to a file named ffreport.log
  1984. ## using a log level of 32 (alias for log level "info"
  1985. FFREPORT=file=ffreport.log:level=32 ffmpeg -i input output
  1986.  
  1987.  
  1988. ffmpeg -cpuflags -sse+mmx ...
  1989. ffmpeg -cpuflags mmx ...
  1990. ffmpeg -cpuflags 0 ...
  1991. ffmpeg -opencl_bench
  1992. ffmpeg -opencl_options platform_idx=<pidx>:device_idx=<didx> ...
  1993. ffmpeg -i input.flac -id3v2_version 3 out.mp3
  1994. ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
  1995. ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
  1996. ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
  1997. ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts
  1998. ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
  1999. ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
  2000. ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg
  2001. ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
  2002. ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
  2003. ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
  2004. ffmpeg -f flv -i myfile.flv ...
  2005. ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
  2006. ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
  2007. ffmpeg -i img.jpeg img.png
  2008. ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
  2009. ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
  2010. ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
  2011. ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
  2012. ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
  2013. ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
  2014. ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  2015. ffmpeg -i file:input.mpeg output.mpeg
  2016. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://<server>:<port>
  2017. ffmpeg -i http://<server>:<port> -c copy somefile.ogg
  2018. ffmpeg -listen 1 -i http://<server>:<port> -c copy somefile.ogg
  2019. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://<server>:<port>
  2020. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  2021. ffmpeg -i input.flv -f avi -y md5:
  2022. cat test.wav | ffmpeg -i pipe:0
  2023. cat test.wav | ffmpeg -i pipe:
  2024. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  2025. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  2026. ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@myserver/
  2027. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  2028. ffmpeg -re -i <input> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  2029. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp <output>
  2030. ffmpeg -re -i <input> -f sap sap://224.0.0.255?same_port=1
  2031. ffmpeg -re -i <input> -f sap sap://224.0.0.255
  2032. ffmpeg -re -i <input> -f sap sap://[ff0e::1:2:3:4]
  2033. ffmpeg -i <input> -f <format> tcp://<hostname>:<port>?listen
  2034. ffmpeg -i <input> -f <format> tls://<hostname>:<port>?listen&cert=<server.crt>&key=<server.key>
  2035. ffmpeg -i <input> -f <format> udp://<hostname>:<port>
  2036. ffmpeg -i <input> -f mpegts udp://<hostname>:<port>?pkt_size=188&buffer_size=65535
  2037. ffmpeg -i udp://[<multicast-address>]:<port> ...
  2038. ffmpeg -f alsa -i hw:0 alsaout.wav
  2039. ffmpeg -f avfoundation -list_devices true -i ""
  2040. ffmpeg -f avfoundation -i "0:0" out.avi
  2041. ffmpeg -f avfoundation -video_device_index 2 -i ":1" out.avi
  2042. ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi
  2043. ffmpeg -f decklink -list_devices 1 -i dummy
  2044. ffmpeg -f decklink -list_formats 1 -i 'Intensity Pro'
  2045. ffmpeg -format_code Hi50 -f decklink -i 'Intensity Pro' -c:a copy -c:v copy output.avi
  2046. ffmpeg -bm_v210 1 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -c:a copy -c:v copy output.avi
  2047. ffmpeg -channels 16 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder' -c:a copy -c:v copy output.avi
  2048. ffmpeg -f kmsgrab -i - -vf 'hwdownload,format=bgr0' output.mp4
  2049. ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi output.mp4
  2050. ffmpeg -f libndi_newtek -find_sources 1 -i dummy
  2051. ffmpeg -f libndi_newtek -i "DEV-5.INTERNAL.M1STEREO.TV (NDI_SOURCE_NAME_1)" -f libndi_newtek -y NDI_SOURCE_NAME_2
  2052. ffmpeg -list_devices true -f dshow -i dummy
  2053. ffmpeg -f dshow -i video="Camera"
  2054. ffmpeg -f dshow -video_device_number 1 -i video="Camera"
  2055. ffmpeg -f dshow -i video="Camera":audio="Microphone"
  2056. ffmpeg -list_options true -f dshow -i video="Camera"
  2057. ffmpeg -f dshow -audio_pin_name "Audio Out" -video_pin_name 2 -i video=video="@device_pnp_\\?\pci#ven_1a0a&dev_6200&subsys_62021461&rev_01#4&e2c7dd6&0&00e1#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{ca465100-deb0-4d59-818f-8c477184adf6}":audio="Microphone"
  2058. ffmpeg -f dshow -show_video_device_dialog true -crossbar_video_input_pin_number 0
  2059. ffmpeg -f fbdev -framerate 10 -i /dev/fb0 out.avi
  2060. ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
  2061. ffmpeg -f gdigrab -framerate 6 -i desktop out.mpg
  2062. ffmpeg -f gdigrab -framerate 6 -offset_x 10 -offset_y 20 -video_size vga -i desktop out.mpg
  2063. ffmpeg -f gdigrab -framerate 6 -i title=Calculator out.mpg
  2064. ffmpeg -f gdigrab -show_region 1 -framerate 6 -video_size cif -offset_x 10 -offset_y 20 -i desktop out.mpg
  2065. ffmpeg -f iec61883 -i auto -hdvbuffer 100000 out.mpg
  2066. ffmpeg -f jack -i ffmpeg -y out.wav
  2067. ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
  2068. ffmpeg -f libcdio -i /dev/sr0 cd.wav
  2069. ffmpeg -list_devices true -f openal -i dummy out.ogg
  2070. ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
  2071. ffmpeg -f openal -i '' out.ogg
  2072. ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
  2073. ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
  2074. ffmpeg -f pulse -i default /tmp/pulse.wav
  2075. ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
  2076. ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
  2077. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg
  2078. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
  2079. ffmpeg -f x11grab -follow_mouse centered -framerate 25 -video_size cif -i :0.0 out.mpg
  2080. ffmpeg -f x11grab -follow_mouse 100 -framerate 25 -video_size cif -i :0.0 out.mpg
  2081. ffmpeg -f x11grab -show_region 1 -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
  2082. ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_size cif -i :0.0 out.mpg
  2083. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  2084. ffmpeg -i infile -vf scale=640:360 outfile
  2085. ##  [?] See "ffmpeg -filters" to view which filters have timeline support.
  2086. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  2087. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  2088. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  2089. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  2090. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  2091.  
  2092. ffmpeg -shortest     ## extend audio streams to the same length as the video
  2093.  
  2094. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2095. ffmpeg -i INPUT -af atrim=60:120
  2096. ffmpeg -i INPUT -af atrim=end_sample=1000
  2097. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2098. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2099. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2100. ffmpeg -i in.wav -filter_complex
  2101. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2102. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2103. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2104. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2105. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2106. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2107. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2108. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2109. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2110. ffmpeg -i input.png -vf chromakey=green out.png
  2111. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  2112. ffmpeg -i input.png -vf colorkey=green out.png
  2113. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  2114. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@inputMessage=https\\\\\://FFmpeg.org/@inputCorrectionLevel=H -frames:v 1 QRCode.png
  2115. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  2116. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  2117. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  2118. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  2119. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  2120. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  2121. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  2122. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  2123. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  2124. ffmpeg -f lavfi -i B<haldclutsrc>=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  2125. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  2126. ffmpeg -f lavfi -i B<haldclutsrc>=8 -vf "
  2127. ffmpeg -i in.avi -vf "hflip" out.avi
  2128. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  2129. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  2130. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  2131. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  2132. ffmpeg -i left.avi -i right.avi -filter_complex "
  2133. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  2134. ffmpeg -i input.mkv -vf palettegen palette.png
  2135. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  2136. ffmpeg -i input -vf pullup -r 24000/1001 ...
  2137. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--}:x=(w-tw)/2:y=400-ascent'
  2138. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  2139. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  2140. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  2141. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  2142. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  2143. ffmpeg -i main.mpg -i ref.mpg -lavfi  "ssim;[0:v][1:v]psnr" -f null -
  2144. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  2145. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  2146. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  2147. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  2148. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  2149. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  2150. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  2151. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  2152. ffmpeg -i INPUT -vf trim=60:120
  2153. ffmpeg -i INPUT -vf trim=duration=1
  2154. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  2155. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  2156. ffmpeg -i in.avi -vf "vflip" out.avi
  2157. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  2158. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@inputMessage=https\\\\\://FFmpeg.org/@inputCorrectionLevel=H -frames:v 1 QRCode.png
  2159. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  2160. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  2161. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  2162. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  2163. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  2164. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  2165. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  2166. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  2167. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  2168. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  2169. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176. --help full
  2177. --help decoder=
  2178. --help encoder=
  2179. --help demuxer=
  2180. --help muxer=
  2181. --help filter=
  2182.  
  2183.  
  2184. -codecs
  2185. -protocols
  2186. -layouts
  2187.  
  2188.  
  2189.  
  2190.  
  2191. -loglevel trace
  2192. debug
  2193. verbose
  2194. info
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201. -report
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215. -cryptokey         <binary>     .D...... decryption ke
  2216.  
  2217. -fdebug            <flags>      ED...... print specific debug info
  2218.  
  2219.  
  2220.  
  2221. crccheck                     .D...... verify embedded CRCs
  2222.      bitstream                    .D...... detect bitstream specification deviations
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228. "-codec copy" or "-codec: copy" would copy all
  2229.        the streams without reencoding
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
Add Comment
Please, Sign In to add comment