Anonagon

Clip/webm making tutorial

Jun 22nd, 2023
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. ~~~~~What you need to know before reading the rest of this document~~~~~
  2. •This document assumes you have the programs "yt-dlp" and "ffmpeg" downloaded. You don't need to install anything because you will be using the Command Line Interface (CLI), also called the Terminal or the Command Prompt, to run these programs directly
  3.  
  4. Download links:
  5. https://github.com/yt-dlp/yt-dlp#release-files
  6. Select "yt-dlp.exe"
  7. https://ffmpeg.org/download.html
  8. Pick the download for your OS in the "Get packages & executable files" section. For Windows, select the gyan.dev link and then look for the line that says "ffmpeg-git-full.7z". Open the downloaded zip folder, then open the "bin" folder inside of it. From this folder you only need ffmpeg.exe to run these commands, but ffprobe.exe is also very useful for telling you the specifications of any video file you have. ffplay.exe is just a video player. Move ffmpeg.exe and optionally ffprobe.exe to the folder of your choice, the same place you put yt-dlp, and delete the rest of the zip folder you downloaded, you don't need anything else from it
  9.  
  10. •The commands in this document are all executed in your computer's CLI. Access this in Windows by pressing Windows+R and typing "cmd" into the box that appears.
  11.  
  12. •Ensure that your CLI has the same folder open that your programs are in, or else the commands won't work. By default, when you open the CLI it will start in your user folder. If you run the CLI as administrator it will start in the System32 folder. You can change the folder the CLI has open by running the command "cd (filepath)", or if the folder you want is inside the folder you are currently in, you can just enter "cd (foldername)"
  13.  
  14. Example:
  15. My programs yt-dlp and ffmpeg are located in my downloads folder. The command I would use to get there is "cd C:\Users\Anon\Downloads". But since the CLI automatically starts in the "Anon" folder, I can also just type "cd downloads" to get to the same place.
  16.  
  17. •Do not remove quotation marks from any of the commands below, this will break them
  18. •The results of these commands will be placed in the same folder you are operating in
  19. •Video encoding is very CPU intensive, but editing videos from the CLI like this is a lot less intensive than using a video editing program
  20.  
  21. ~~~~~Trimming an already downloaded video~~~~~
  22.  
  23. ffmpeg -i input.mp4 -ss HH:MM:SS -to HH:MM:SS output.mp4
  24.  
  25. -i = input file
  26. -ss = start time
  27. -to = the end timestamp of the capture
  28.  
  29. •Don't specify an end time to capture until the end of the video
  30. •Don't specify a start time to capture from the start until the chosen timestamp
  31. •Run this command without specifying any timestamps in order to re-encode the video without altering it (If you don't know what this means, the next command will tell you)
  32.  
  33. ~~~~~Downloading only part of a video~~~~~
  34.  
  35. yt-dlp -f "(bestvideo+bestaudio/best)[protocol!*=dash]" --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss HH:MM:SS -to HH:MM:SS" "video url"
  36.  
  37. •Only works if the video uses HTTP Live Streaming (HLS) and not Dynamic Adaptive Streaming over HTTP (DASH) (formats for delivering "adaptive bitrate video")
  38. •Twitch uses HLS, YouTube depends on the uploader
  39.  
  40. IMPORTANT:
  41. •The video you download must be re-encoded after using this command. If you don't do this, the first few seconds will likely be corrupted because it is missing what's called a "keyframe". Frames of a video are bunched into groups, and each of these groups has a frame at the beginning called a "keyframe" that serves as the basis for the rest of the frames in that group. Re-encoding a video will repair it and fix that issue. Run the first command in this document without specifying any timestamps in order to re-encode a video without altering it.
  42.  
  43. ~~~~~Converting to webm~~~~~
  44.  
  45. ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 10 -b:v 1000000 -an output.webm
  46.  
  47. -c:v = specify video codec (libvpx = VP8; libvpx-vpx9 = VP9 which is now supported on 4chan)
  48. -crf = Constant Rate Factor; Dictates consistent quality throughout video. Value 0-51, lower is better
  49. -b:v = specify bitrate for video codec. If the resulting webm is over the filesize limit (4mb), lower this value until it isn't
  50. -an = removes the audio from the video. Most boards on 4chan do not let you post webms with audio, so you must remove it
  51.  
  52. ~~~~~Other options for editing videos~~~~~
  53.  
  54. Resize video by a specified ratio:
  55. -vf "scale=iw(* OR /)x:ih(* OR /)x"
  56.  
  57. iw = width, ih = height
  58. Example: -vf "scale=iw/2:ih/2" halves the dimensions of the video
  59.  
  60. Crop video:
  61. -filter:v "crop=out_w:out_h:x:y"
  62.  
  63. out_w = output width
  64. out_h = output height
  65. x = X-coord of top left pixel
  66. y = Y-coord of top left pixel
  67.  
Advertisement
Add Comment
Please, Sign In to add comment