├── LICENSE ├── README.md └── readme.TR.md /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Useful FFmpeg commands

2 | 3 | Turkish 4 | 5 | The use of video in digital life is increasing exponentially day by day. 6 | I prepared a document explaining how you can easily find answers to video solutions/problems that you will need in daily life with FFmpeg library. 7 | I show you which commands to run for video solutions you will need with about 20 different scenarios in the file. 8 | 9 | Download FFmpeg to your computer for Windows => https://github.com/BtbN/FFmpeg-Builds/releases for Mac Os => https://evermeet.cx/ffmpeg/ After downloading from .cx/ffmpeg/ffmpeg-105012-gbb813ccb45.zip addresses, you can run ffmpeg as arguments by entering bin folder via terminal. 10 | 11 |
    12 |
  1. Convert any video format to other format.

  2. 13 | 14 | `ffmpeg -i source.avi output.mp4` 15 | 16 | `ffmpeg -i source.mov output.mp4` 17 | 18 |
  3. Increasing/decreasing the framerate of the video. (Twitter and some platforms require 30FPS video)

  4. 19 | 20 | `ffmpeg -i source.mp4 -framerate 30 output30fps.mp4` 21 | 22 |
  5. Adding audio to video.

  6. 23 | 24 | > It will be as long as the video or audio, whichever is shorter. 25 | 26 | `ffmpeg -i source.mp4 -i sound.mp3 -vcodec copy -map 0:v -map 1:a -map 1:a -shortest output.mp4` 27 | 28 | 29 |
  7. Cutting the first three seconds of the video.

  8. 30 | 31 | `ffmpeg -i source.mp4 -t 3 output3seconds.mp4` 32 | 33 | > or 34 | 35 | `ffmpeg -i source.mp4 -t 00:00:03 output3seconds.mp4` 36 | 37 |
  9. Cut a specific range of video.

  10. 38 | 39 | > Getting next 3 seconds starting from 3 seconds 40 | 41 | `ffmpeg -i source.mp4 -ss 3 -t 3 source3seconds.mp4` 42 | 43 |
  11. Cut video from a specific second to the end of the video

  12. 44 | 45 | `ffmpeg -i source.mp4 -ss 3 output3seconds.mp4` 46 | 47 | `ffmpeg -i source.mp4 -ss 00:00:03 output3seconds.mp4` 48 | 49 | 50 |
  13. Convert video to animated gif.

  14. 51 | 52 | `ffmpeg -i source.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif` 53 | 54 | 55 |
  15. Converting part of video to animated gif.

  16. 56 | 57 | `ffmpeg -i source.mp4 -ss 1 -t2 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 tar.gif` 58 | 59 |
  17. Concat two videos (without audio).

  18. 60 | 61 | `ffmpeg -i source1.mp4 -i source2.mp4 -y -filter_complex "[0:v][1:v] concat=n=2:v=1:[v]" -map "[v]" output.mp4` 62 | 63 |
  19. Concat two videos back-to-back (with audio).

  20. 64 | 65 | `ffmpeg -i source1.mp4 -i source2.mp4 -y -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0] concat=n=2:v=1:a=1 [v] [a]" -map "[a]" -map "[v]" output.mp4` 66 | 67 |
  21. Adding a watermark to the middle of the screen.

  22. 68 | 69 | `ffmpeg -i source.mp4 -i logo.png -filter_complex "overlay = (main_w - overlay_w)/2:(main_h - overlay_h) / 2" watermark.mp4 ` 70 | 71 |
  23. Adding a watermark to a specific point of the screen.

  24. 72 | 73 | `ffmpeg -i source.mp4 -i logo.png -filter_complex "overlay = (main_w - overlay_w)/2:(main_h - overlay_h) / 2" watermark.mp4 ` 74 | 75 |
  25. Extracting all the frames in the video as an image

  26. 76 | 77 | `ffmpeg -i source.mp4 "%04d.png"` 78 | 79 |
  27. Take a screenshot of a specific frame in the video.

  28. 80 | 81 | `ffmpeg -i wm.mp4 -ss 00:00:01.23 -vframes 1 -q:v 2 output.jpg` 82 | 83 |
  29. Take a screenshot from every 1 second of the video

  30. 84 | 85 | `ffmpeg -i wm.mp4 -r 1 -f image2 screenshot-%03d.jpg` 86 | 87 |
  31. Merging two separate audio files.

  32. 88 | 89 | `ffmpeg -i sound1.wav -i sound2.wav -filter_complex "[0:0][1:0]concat=n=2:v=0:a=1[out]" -map "[out]" soundconcat.wav` 90 | 91 |
  33. Extracting the audio file from the video as mp3.

  34. 92 | 93 | `ffmpeg -i source.mp4 output.mp3` 94 | 95 |
  35. To mute the video.

  36. 96 | 97 | `ffmpeg -i source.mp4 -c copy -an sessiz.mp4` 98 | 99 |
  37. Making video from photo gallery.

  38. 100 | 101 | `ffmpeg -f concat -i filelist.txt -i audio.mp3 -c:a copy output.mp4` 102 | 103 | filelist.txt sample file 104 |
    105 | a1.jpg
    106 | a2.jpg
    107 | a3.jpg
    108 | 
    109 |
  39. Writing text on the video with the desired font.

  40. 110 | 111 | `ffmpeg -i source.mp4 -filter:v "drawtext=enable='between(t,0,2)':fontsize=30:fontfile=font.otf:fontcolor=yellow:text='my text':x = (w - text_w) / 2:y = (h - text_h - line_h) / 2" output.mp4` 112 | 113 | > between(t,0,2) 0-2 seconds 114 | 115 | > center the screen x = (w - text_w) / 2:y = (h - text_h - line_h) / 2 116 | 117 | > You can make it output in the position you want by giving x and y values. 118 | 119 |
  41. Split video into segments

  42. 120 | 121 | `ffmpeg -i input.mp4 -c copy -map 0 -segment_time 4 -f segment -segment_list list.txt output_video%03d.mp4` 122 | 123 |
  43. Concat segmented video

  44. 124 | 125 | `ffmpeg -y -v error -i list.txt -map 0 -c copy output.mp4` 126 |
127 | -------------------------------------------------------------------------------- /readme.TR.md: -------------------------------------------------------------------------------- 1 | =>English 2 | 3 | Bant genişliklerinin artmasıyla dijital hayatta video kullanımı her geçen gün katlanarak artıyor. Ücretsiz FFmpeg programı ve kütüphanelerini kullanarak gündelik hayatta sıkça ihtiyaç duyacağınız video çözümlerine/sorunlarına bu kütüphane ile nasıl kolaylıkla cevap bulacağınızı anlatan bir doküman hazırladım. Dosyada 20 kadar farklı senaryo ile ihtiyaç duyacağınız video çözümleri için hangi komutları çalıştırmanız gerektiğini gösteriyorum. Doküman hakkındaki soru/sorularınızı Issues bölümünden iletebilirsiniz. 4 | 5 | FFmpeg programını bilgisayarınıza 6 | Windows için => https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-latest-win64-gpl-shared-4.4.zip 7 | Mac Os için => https://evermeet.cx/ffmpeg/ffmpeg-105012-gbb813ccb45.zip 8 | Adreslerinden indirdikten sonra terminal üzerinden bin klasörüne girerek `ffmpeg argümanlar` şeklinde çalıştırabilirsiniz 9 | 10 |
    11 |
  1. Herhangi bir video formatını diğer formata çevirmek.

  2. 12 | 13 | `ffmpeg -i source.avi output.mp4` 14 | 15 | `ffmpeg -i source.mov output.mp4` 16 | 17 |
  3. Videonun framerate'ini arttırma/azaltmak. (Twitter ve bazı platformlar 30FPS video istemekteler)

  4. 18 | 19 | `ffmpeg -i source.mp4 -framerate 30 output30fps.mp4` 20 | 21 |
  5. Videoya ses eklemek.

  6. 22 | 23 | > Video veya görüntüden kısa olanın süresinde video biter. 24 | 25 | `ffmpeg -i source.mp4 -i sound.mp3 -vcodec copy -map 0:v -map 1:a -map 1:a -shortest output.mp4` 26 | 27 | 28 |
  7. Videonun ilk üç saniyesini almak/kesmek.

  8. 29 | 30 | `ffmpeg -i source.mp4 -t 3 output3seconds.mp4` 31 | 32 | > ya da 33 | 34 | `ffmpeg -i source.mp4 -t 00:00:03 output3seconds.mp4` 35 | 36 |
  9. Videonun belirli bir aralığını almak.

  10. 37 | 38 | > 3. saniyeden başlayarak sonraki 3 saniye alınıyor 39 | 40 | `ffmpeg -i source.mp4 -ss 3 -t 3 source3seconds.mp4` 41 | 42 |
  11. Belirli bir saniyeden videonun sonuna kadar videoyu kesmek.

  12. 43 | 44 | `ffmpeg -i source.mp4 -ss 3 output3seconds.mp4` 45 | 46 | `ffmpeg -i source.mp4 -ss 00:00:03 output3seconds.mp4` 47 | 48 | 49 |
  13. Videoyu animasyonlu gife çevirmek.

  14. 50 | 51 | `ffmpeg -i source.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif` 52 | 53 | > fps saniyelik frame sayısını belirtir scale ile çözünürlük belirtebilirsiniz 54 | 55 | > loop tekrar sayısını belirtir 56 | 57 |
  15. Videonun bir bölümünü animasyonlu gife çevirmek.

  16. 58 | 59 | `ffmpeg -i source.mp4 -ss 1 -t2 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 tar.gif` 60 | 61 |
  17. İki videoyu arka arkaya eklemek (audiosuz).

  18. 62 | 63 | `ffmpeg -i source1.mp4 -i source2.mp4 -y -filter_complex "[0:v][1:v] concat=n=2:v=1:[v]" -map "[v]" output.mp4` 64 | 65 |
  19. İki videoyu arka arkaya eklemek (audio ile).

  20. 66 | 67 | `ffmpeg -i source1.mp4 -i source2.mp4 -y -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0] concat=n=2:v=1:a=1 [v] [a]" -map "[a]" -map "[v]" output.mp4` 68 | 69 |
  21. Ekran ortasına watermark filigran eklemek.

  22. 70 | 71 | `ffmpeg -i source.mp4 -i logo.png -filter_complex "overlay = (main_w - overlay_w)/2:(main_h - overlay_h) / 2" watermark.mp4 ` 72 | 73 |
  23. Ekranın belirli bir noktasına watermark filigran eklemek.

  24. 74 | 75 | `ffmpeg -i source.mp4 -i logo.png -filter_complex "overlay = (main_w - overlay_w)/2:(main_h - overlay_h) / 2" watermark.mp4 ` 76 | 77 |
  25. Videodaki tüm frameleri resim olarak çıkarma

  26. 78 | 79 | `ffmpeg -i source.mp4 "%04d.png"` 80 | 81 |
  27. Videodaki belirli bir karenin ekran görüntüsünü almak.

  28. 82 | 83 | `ffmpeg -i wm.mp4 -ss 00:00:01.23 -vframes 1 -q:v 2 output.jpg` 84 | 85 |
  29. Videodaki her 1 saniyeden ekran görüntüsü çıkarmak

  30. 86 | 87 | `ffmpeg -i wm.mp4 -r 1 -f image2 screenshot-%03d.jpg` 88 | 89 |
  31. İki ayrı ses dosyasını birleştirmek.

  32. 90 | 91 | `ffmpeg -i sound1.wav -i sound2.wav -filter_complex "[0:0][1:0]concat=n=2:v=0:a=1[out]" -map "[out]" soundconcat.wav` 92 | 93 |
  33. Videodaki ses dosyasını mp3 olarak çıkarmak.

  34. 94 | 95 | `ffmpeg -i source.mp4 output.mp3` 96 | 97 |
  35. Videoyu sessiz hale getirmek.

  36. 98 | 99 | `ffmpeg -i source.mp4 -c copy -an sessiz.mp4` 100 | 101 |
  37. Fotoğraf galerisinden video yapmak.

  38. 102 | 103 | `ffmpeg -f concat -i filelist.txt -i audio.mp3 -c:a copy output.mp4` 104 | 105 | filelist.txt örneği 106 |
    107 | a1.jpg
    108 | a2.jpg
    109 | a3.jpg
    110 | 
    111 |
  39. Video üzerine istenilen yazı fontu ile yazı yazmak.

  40. 112 | 113 | `ffmpeg -i source.mp4 -filter:v "drawtext=enable='between(t,0,2)':fontsize=30:fontfile=font.otf:fontcolor=yellow:text='my text':x = (w - text_w) / 2:y = (h - text_h - line_h) / 2" output.mp4` 114 | 115 | > between(t,0,2) 0-2 saniye arasında gözüküyor 116 | 117 | > ekranı ortalıyoruz x = (w - text_w) / 2:y = (h - text_h - line_h) / 2 118 | 119 | > x ve y değeri vererek istediğiniz pozisyonda çıkmasını sağlayabilirsiniz. 120 | 121 |
  41. Videoyu segmentlere ayırma

  42. 122 | 123 | `ffmpeg -i input.mp4 -c copy -map 0 -segment_time 4 -f segment -segment_list list.txt output_video%03d.mp4` 124 | 125 |
  43. Segmentlere ayrılmış videoyu birleştirme

  44. 126 | 127 | `ffmpeg -y -v error -i list.txt -map 0 -c copy output.mp4` 128 |
129 | --------------------------------------------------------------------------------