Last active
July 7, 2021 13:37
-
-
Save mariohercules/30fa390c5a162e8bbcaecf7e8a247f92 to your computer and use it in GitHub Desktop.
ffmpeg via terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4 | |
$ ffmpeg -i "http://host/folder/file.m3u8" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 file.mp4 | |
trying to understand what the options mean | |
ffmpeg -i "http://host/folder/file.m3u8" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 file.mp4 | |
-bsf:a aac_adtstoasc | |
bsf = (bit stream filter) | |
use aac_adtstoasc bsf for a audio streams, this is need if .m3u8 file consists with .ts files and output is .mp4 | |
reference https://ffmpeg.org/ffmpeg-bitstream-filters.html#aac_005fadtstoasc | |
-c copy -vcodec copy | |
skip codec (encode and decode), just demux and mux | |
I guess .ts and .mp4, for video stream, they are both H.264 codec, just guess. | |
reference https://ffmpeg.org/ffmpeg.html#Stream-copy | |
-crf 50 | |
reference https://trac.ffmpeg.org/wiki/Encode/H.264#CRFExample | |
the example shows -c:a copy did not re-encode, guess this option is not needed here. | |
And 0 is lossless, 23 is the default, and 51 is worst quality possible 😢 | |
REF: https://gist.github.com/tzmartin/fb1f4a8e95ef5fb79596bd4719671b5d | |
REF2: https://github.com/homebrew-ffmpeg/homebrew-ffmpeg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment