bash
Bash - Video Related Stuff
Youtube-dl:
apt-get install python3-pip pip install --upgrade youtube_dl youtube-dl https://some.site.com/some/video/23958797
Compress downloaded video using libx265 & compression rate 28
# This codec won't play on some video players: ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
Taking audio from video:
ffmpeg -i input.webm -vn -acodec copy output.mp3
This command tells ffmpeg to:
- use the input.webm file as the input
- discard the video stream (-vn)
- copy the audio stream as is (-acodec copy)
- save the output as an MP3 file named output.mp3
Note that if you want to save the output as a different audio format, you can replace "output.mp3" with the desired file extension (e.g. "output.ogg" for Ogg Vorbis format).
(If audio codec isn't already mp3 in the video:)
ffmpeg -i input.webm -vn -acodec libmp3lame -q:a 2 output.mp3
This command tells ffmpeg to:
- use the input.webm file as the input
- discard the video stream (-vn)
- use the libmp3lame codec to encode the audio stream to MP3 format (-acodec libmp3lame)
- set the quality of the MP3 output to a value of 2 (-q:a 2)
- save the output as an MP3 file named output.mp3
The -q:a option sets the quality of the MP3 output, with a range of 0 to 9, where 0 is the best quality and 9 is the worst. The default value is 4, but a value of 2 or 3 is generally recommended for a good balance of size and quality.