elbervalim

cmd-survive-guive_git

Jul 22nd, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. ======================================================
  2.  
  3. **técnica de mapping**
  4. video1.avi -i video2.avi -filter complex “[0:v:0] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [v] [a]” -map “[v]” -map “[a]” output_video.avi
  5.  
  6. // técnica dos 3 arqivos
  7. ffmpeg -i file1.mp4 -i file2.mp4 -i file3.mp4 \
  8. -filter_complex "[0:v] [1:v] [2:v]
  9. concat=n=3:v=1:a=1 [v] [a]" \
  10. -map "[vv]" -map "[aa]" mergedVideo.mp4
  11.  
  12. **Concat demuxer**
  13. # criar arquivo seguindo modelo
  14. file '/path/to/file1.wav'
  15. file '/path/to/file2.wav'
  16. file '/path/to/file3.wav'
  17. $ ffmpeg -f concat -i list.txt -c copy out.mp4
  18. # concat modo safe zero
  19. $ ffmpeg -f concat -safe 0 -i files.txt -c copy output.mkv
  20.  
  21. **Trim 2 segments and export in the same output**
  22. ffmpeg -i video \
  23. -vf "select='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
  24. setpts=N/FRAME_RATE/TB" \
  25. -af "aselect='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
  26. asetpts=N/SR/TB" out.mp4
  27.  
  28. **conversaão twitter**
  29. ffmpeg -i video.mp4 -r 25 -crf 23 -c:v libx264 -b:v 1M -vf scale="trunc(oh*a/2)*2:360" -y video-tt_360.mp4
  30. ffmpeg -i "video.mp4" -ss 00:25.1 -t 50 -r 30 -crf 23 -c:v libx264 -b:v 1.5M -vf scale="trunc(oh*a/2)*2:480" -an -y video-tt_480.mp4
  31.  
  32. **template -t *.mp4, sem audio**
  33. ffmpeg -i comp_.mp4 -f mp4 -vcodec libx264 -preset fast -profile:v main -an -ss 00:00 -t 00:00 output_comp_.mp4
  34.  
  35. **template -t *.mp4, com audio**
  36. ffmpeg -i comp_.mp4 -f mp4 -vcodec libx264 -preset fast -profile:v main -a:c -ss 00:00 -t 00:00 output_comp_.mp4
  37.  
  38. **skip frames**
  39. ffmpeg -i in1.mp4 -vf fps=fps=1.5 -an -y output.mp4
  40. ffmpeg -i output.mp4 -vf eq=saturation=1.5 -y output2.mp4
  41.  
  42. **This will extract all I-frames from frame #0 to frame #300**
  43. ffmpeg -i in.mp4 -vf select='eq(pict_type,I)*between(n,0,300)' -vsync 0 i%03d.png
  44. ffmpeg -i 2.flv -vf "select=eq(pict_type\,I)" -vsync vfr frame-%02d.png
  45.  
  46. **produzir frames**
  47. ffmpeg -i input.mp4 -vf fps=1 out%d.png (testar com esse nome: frame%06d.png)
  48. ffmpeg -i input.mp4 -vf fps=3 out%d.png// 3 frames por segundos exp
  49. ffmpeg -i input.mp4 -vf fps=1/60 out%d.png // 1 frame por minuto
  50. ffmpeg -i input.mp4 -vf fps=1/600 out%d.png // 1 frame a cada 10min
  51. ffmpeg -i test-%09d.png -vcodec libx264 -pix_fmt yuv420p test-merged-qt.mp4
  52.  
  53. **sequencia de imagem pra video, especificando fps final**
  54. ffmpeg -framerate 12 -start_number 9685 -i DSC_%04d.JPG -c:v libx264 -r 24 output-v5.mp4
  55.  
  56. **sequencia de imagem pra video, especificando fps final + range de frames**
  57. # comando -frames:v é o que define a abra
  58. ffmpeg -framerate 12 -start_number 9685 -i DSC_%04d.JPG -frames:v 9800 -c:v libx264 -r 24 output-v5.mp4
  59.  
  60. **rename**
  61. rename s'/^DSC/DSC_/' *.JPG
  62. rename s'/^MOV/MOV_/' *.MPG
  63.  
  64. **remover .THM**
  65. rm *.THM
  66.  
  67. ===========================================
  68.  
  69. ffmpeg -i inputVideo.mp4 -ss 00:03 -to 00:08 -c:v libx264 -crf 30 trim_opseek_encode.mp4
  70.  
  71. // re-scale + crop
  72. ffmpeg -i input.mp4 -filter_complex
  73. "[0:v]trim=start=0:end=3,setpts=PTS-STARTPTS,split[va1][vb1];
  74. [0:v]trim=start=5:end=10,setpts=PTS-STARTPTS,split[va2][vb2];
  75. [0:a]atrim=start=0:end=3,asetpts=PTS-STARTPTS,asplit[aa1][ab1];
  76. [0:a]atrim=start=5:end=10,asetpts=PTS-STARTPTS,asplit[aa2][ab2];
  77. [va1]scale=700:700:force_original_aspect_ratio=increase,crop=700:700[700_1];
  78. [va2]scale=700:700:force_original_aspect_ratio=increase,crop=700:700[700_2];
  79. [vb1]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920[1920_1];
  80. [vb2]scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920[1920_2]"
  81. -map "[700_1]" -map "[aa1]" 1a.mp4
  82. -map "[700_2]" -map "[aa2]" 1b.mp4
  83. -map "[1920_1]" -map "[ab1]" 2a.mp4
  84. -map "[1920_2]" -map "[ab2]" 2b.mp4
  85.  
  86. ffmpeg -i in.mp4 -vf select='eq(pict_type,I)*between(t\,0\,300)' -vsync 0 i%03d.png
  87. ffmpeg -i in.m4v -vf 'select='eq(between*(t\,0\,300))' -vsync 0 i%03d.png
  88.  
  89. **gif: alta qualidade**
  90. ffmpeg -ss 61.0 -t 2.5 -i StickAround.mp4 -filter_complex "[0:v] palettegen" palette.png
  91. ffmpeg -ss 61.0 -t 2.5 -i StickAround.mp4 -i palette.png -filter_complex "[0:v][1:v] paletteuse" prettyStickAround.gif
  92.  
  93. **gif: preservando transparencia**
  94. ffmpeg -i input.gif -vf -filter_complex "[0:v] scale=320:240,split [a][b];\
  95. [a] palettegen=reserve_transparent=on:transparency_color=ffffff p]; \
  96. [b][p] paletteuse" output_converted.gif
  97.  
  98. **gif: zerando pts**
  99. ffmpeg -y -i .gif -filter_complex /
  100. "fps=15,setsar=1,palettegen" palette.png
  101. ffmpeg -y -i .gif /
  102. -i palette.png -filter_complex "[0]fps=15,setsar=1[x];[x][1:v]paletteuse" /
  103. _480p.gif
  104.  
  105. **gif: paleta e gerar gif no mesmo comando**
  106. ffmpeg -i "noise-pigeon-2329.mp4" -filter:v " \
  107. fps=18,scale=420:-1:flags=lanczos,split[s0][s1]; \
  108. [s0]palettegen[p]; \
  109. [s1][p]paletteuse" ../exp/noise-pigeon-2329.gif -y -hide_banner
  110.  
  111. **gif: seleção de tempos**
  112. ffmpeg -i output_video_no_music3.mp4 -filter:v " \
  113. select='between(t\,0,3.75)+between(t\,8.25,9)+between(t\,13,14)+between(t\,16,20)'
  114. ,fps=15,scale=480:-1:flags=lanczos,split[s0][s1]; \
  115. [s0]palettegen[p]; \
  116. [s1][p]paletteuse" NAME.gif -y -hide_banner
  117.  
  118. ffmpeg -i video \
  119. -vf "select='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
  120. setpts=N/FRAME_RATE/TB" \
  121. -af "aselect='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
  122. asetpts=N/SR/TB" out.mp4
  123.  
  124. ffmpeg -i test.mp4 -filter_complex \
  125. '[0:v] trim=start=5:end=10, setpts=PTS-STARTPTS [v0]; \
  126. [0:a]atrim=start=5:end=10,asetpts=PTS-STARTPTS [a0];'\
  127. -map [v0] -map [a0] output.mp4
  128.  
  129. ffmpeg -i video.mp4 \
  130. -filter_complex "atrim=start=2:end=11, asetpts=N/SR/TB" out-atrim.mp3
  131.  
  132. **mapping 1 video sem audio com 1 arquivo de audio**
  133. ffmpeg -y -i out-aselect-intro.mp4 -i out-aselect-intro.mp3 \
  134. -map 0:0 -map 1:0 merged_intro.mp4
  135.  
  136.  
  137. **imagem estatica para video de 15s**
  138. ffmpeg -loop 1 -i image.png -c:v libx264 -t 15 -pix_fmt yuv420p -vf scale=320:240 out.mp4
  139. The -t 15 makes it 15 seconds long.
  140. The -vf scale=320:240 sets the width/height.
  141.  
  142.  
  143. **fade out ffmpeg**
  144. ffmpeg -i input.mp4 \
  145. -filter_complex \
  146. "[0:v]fade=t=out:st=1798:d=1[v]; \
  147. [0:a]afade=t=out:st=1798:d=1[a]" \
  148. -map "[v]" -map "[a]" output.mp4
  149.  
  150. **Thumbnail**
  151. $ ffmpeg -i video.mp4 -ss 00:00:14.435 -vframes 1 imagem.png
  152.  
  153. **seq de img para gif**
  154. ffmpeg -framerate 12 -start_number 0100 -i DSC_%04d.JPG -vframes 000 \
  155. -filter:v " \
  156. fps=15,scale=480:-1:flags=lanczos,split[s0][s1]; \
  157. [s0]palettegen[p]; \
  158. [s1][p]paletteuse" \
  159. just-pigeon.gif -y -hide_banner
  160.  
  161. **pts no filtro**
  162. trim=start=0:end=3,setpts=PTS-STARTPTS
  163.  
  164.  
  165. ffmpeg -i in.gif -filter:v "crop=out_w:out_h:x:y" out.gif
  166. reply that: https://stackoverflow.com/questions/69010256/can-ffmpeg-crop-gif-image-under-1-second
  167.  
  168. **resize/crop**
  169. ffmpeg -i INPUT.mov -vf "scale=356:278:flags=spline,unsharp=2.5:2.5:1.5" -b:v 256k OUTPUT.mov
  170.  
  171. ffmpeg -i video.mp4 -r 30 -crf 23 -c:v libx264 -b:v 1.2M -vf scale="trunc(oh*a/2)*2:400" -y video-out.mp4
  172.  
  173. ffmpeg -i input.avi -filter:v scale=720:-1 -c:a copy output.mkv
  174.  
  175. //altura
  176. scale="trunc(oh*a/2)*2:720"
  177.  
  178. ...or a given width (1280 in this example):
  179.  
  180. //largura
  181. scale="1280:trunc(ow/a/2)*2"
  182.  
  183.  
  184.  
  185. // my code
  186. ffmpeg -framerate 6 -start_number 183 -i DSC_%5d.JPG -vframes 30 -filter:v " \
  187. 8813 2022-05-22 20:57:55 fps=12,scale=480:-1:flags=lanczos,crop=360:360,setsar=1,split[s0][s1]; \
  188. 8814 2022-05-22 20:57:55 [s0]palettegen[p]; \
  189. 8815 2022-05-22 20:57:55 [s1][p]paletteuse" ../just-pigeon-3-cropped.gif -y -hide_banner
  190. ref com odeveria ser: crop=ih:ih:20:10
Advertisement
Add Comment
Please, Sign In to add comment