Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ~~~~~What you need to know before reading the rest of this document~~~~~
- •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
- Download links:
- https://github.com/yt-dlp/yt-dlp#release-files
- Select "yt-dlp.exe"
- https://ffmpeg.org/download.html
- 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
- •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.
- •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)"
- Example:
- 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.
- •Do not remove quotation marks from any of the commands below, this will break them
- •The results of these commands will be placed in the same folder you are operating in
- •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
- ~~~~~Trimming an already downloaded video~~~~~
- ffmpeg -i input.mp4 -ss HH:MM:SS -to HH:MM:SS output.mp4
- -i = input file
- -ss = start time
- -to = the end timestamp of the capture
- •Don't specify an end time to capture until the end of the video
- •Don't specify a start time to capture from the start until the chosen timestamp
- •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)
- ~~~~~Downloading only part of a video~~~~~
- 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"
- •Only works if the video uses HTTP Live Streaming (HLS) and not Dynamic Adaptive Streaming over HTTP (DASH) (formats for delivering "adaptive bitrate video")
- •Twitch uses HLS, YouTube depends on the uploader
- IMPORTANT:
- •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.
- ~~~~~Converting to webm~~~~~
- ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 10 -b:v 1000000 -an output.webm
- -c:v = specify video codec (libvpx = VP8; libvpx-vpx9 = VP9 which is now supported on 4chan)
- -crf = Constant Rate Factor; Dictates consistent quality throughout video. Value 0-51, lower is better
- -b:v = specify bitrate for video codec. If the resulting webm is over the filesize limit (4mb), lower this value until it isn't
- -an = removes the audio from the video. Most boards on 4chan do not let you post webms with audio, so you must remove it
- ~~~~~Other options for editing videos~~~~~
- Resize video by a specified ratio:
- -vf "scale=iw(* OR /)x:ih(* OR /)x"
- iw = width, ih = height
- Example: -vf "scale=iw/2:ih/2" halves the dimensions of the video
- Crop video:
- -filter:v "crop=out_w:out_h:x:y"
- out_w = output width
- out_h = output height
- x = X-coord of top left pixel
- y = Y-coord of top left pixel
Advertisement
Add Comment
Please, Sign In to add comment