Last active
July 13, 2024 17:44
-
-
Save acceptableEngineering/ba6062358e081196360b941ac93da7fc to your computer and use it in GitHub Desktop.
Revisions
-
acceptableEngineering revised this gist
May 5, 2023 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,15 @@ ffmpeg -i in.flv -vcodec copy out.mp4 --- ### Analysis Generating a waveform from a file with audio: ``` ffmpeg -i in.mp3 -filter_complex "showwavespic=s=1280x320" -frames:v 1 ./waveform.png ``` --- ### Adjustments / Processing Boost audio level (volume) without re-encoding: -
acceptableEngineering revised this gist
May 3, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -61,7 +61,7 @@ ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -a Mount RTSP as virtual video device: ``` ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev/video0 ``` [Source](https://superuser.com/a/1489325) @@ -72,7 +72,7 @@ $ ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev ### Ripping YouTube Video: 1. Enumerate format and resolution choices: ``` youtube-dl --list-formats 'https://www.youtube.com/watch?v=C_YiECKlPuE' ``` Output: ``` -
acceptableEngineering revised this gist
May 3, 2023 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ These are commands I use on a regular basis. For the sake of simplicity, the fil --- ## FFmpeg ### Media Conversion @@ -104,6 +104,8 @@ format code extension resolution note ``` 2. The choice with ID 96 "(best)" seems ideal, let's use that one and save it as an MP4: ``` ffmpeg -i $(youtube-dl -f 96 -g 'https://www.youtube.com/watch?v=C_YiECKlPuE') \ -c:v copy -c:a aac -strict experimental output.mp4 ``` --- -
acceptableEngineering revised this gist
May 3, 2023 . 1 changed file with 46 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,8 @@ These are commands I use on a regular basis. For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis. --- ## FFMPEG ### Media Conversion @@ -61,4 +63,47 @@ Mount RTSP as virtual video device: ``` $ ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev/video0 ``` [Source](https://superuser.com/a/1489325) --- ## youtube-dl CLI ### Ripping YouTube Video: 1. Enumerate format and resolution choices: ``` $ youtube-dl --list-formats 'https://www.youtube.com/watch?v=C_YiECKlPuE' ``` Output: ``` [youtube] 2nAHpvFXo9s: Downloading webpage [youtube] 2nAHpvFXo9s: Downloading m3u8 information [youtube] 2nAHpvFXo9s: Downloading MPD manifest [info] Available formats for 2nAHpvFXo9s: format code extension resolution note 139 m4a audio only DASH audio 64k , m4a_dash container, mp4a.40.5 (22050Hz) 140 m4a audio only DASH audio 144k , m4a_dash container, mp4a.40.2 (44100Hz) 278 webm 256x144 DASH video 80k , webm_dash container, vp9, 30fps, video only 242 webm 426x240 DASH video 139k , webm_dash container, vp9, 30fps, video only 160 mp4 256x144 DASH video 192k , mp4_dash container, avc1.4d400c, 30fps, video only 243 webm 640x360 DASH video 240k , webm_dash container, vp9, 30fps, video only 244 webm 854x480 DASH video 415k , webm_dash container, vp9, 30fps, video only 133 mp4 426x240 DASH video 419k , mp4_dash container, avc1.4d4015, 30fps, video only 134 mp4 640x360 DASH video 772k , mp4_dash container, avc1.4d401e, 30fps, video only 247 webm 1280x720 DASH video 774k , webm_dash container, vp9, 30fps, video only 135 mp4 854x480 DASH video 1077k , mp4_dash container, avc1.4d401f, 30fps, video only 248 webm 1920x1080 DASH video 1402k , webm_dash container, vp9, 30fps, video only 136 mp4 1280x720 DASH video 2187k , mp4_dash container, avc1.4d401f, 30fps, video only 137 mp4 1920x1080 DASH video 4199k , mp4_dash container, avc1.4d4028, 30fps, video only 91 mp4 256x144 269k , avc1.4d400c, 30.0fps, mp4a.40.5 92 mp4 426x240 507k , avc1.4d4015, 30.0fps, mp4a.40.5 93 mp4 640x360 962k , avc1.4d401e, 30.0fps, mp4a.40.2 94 mp4 854x480 1282k , avc1.4d401f, 30.0fps, mp4a.40.2 95 mp4 1280x720 2447k , avc1.4d401f, 30.0fps, mp4a.40.2 96 mp4 1920x1080 4561k , avc1.4d4028, 30.0fps, mp4a.40.2 (best) ``` 2. The choice with ID 96 "(best)" seems ideal, let's use that one and save it as an MP4: ``` ffmpeg -i $(youtube-dl -f 96 -g 'https://www.youtube.com/watch?v=2nAHpvFXo9s') \ -c:v copy -c:a aac -strict experimental output.mp4 ``` -
acceptableEngineering revised this gist
May 3, 2023 . 1 changed file with 16 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,70 +1,63 @@ # Description These are commands I use on a regular basis. For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis. ## FFMPEG ### Media Conversion High-Quality, Infinitely Looping GIF from MP4: ``` ffmpeg -i input.mp4 -vf "fps=12,scale=720:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif ``` Convert FLV to MP4 without full re-encode: ``` ffmpeg -i in.flv -vcodec copy out.mp4 ``` --- ### Adjustments / Processing Boost audio level (volume) without re-encoding: ``` ffmpeg -i in.mp4 -vcodec copy -af "volume=10dB" out.mp4 ``` Delay audio: ``` ffmpeg -i "in.mp4" -itsoffset 0.3 -i "in.mp4" -map 0:v -map 1:a -vcodec copy -acodec copy "out.mp4" ``` --- ### Ripping Rip and audio stream (I use this to periodically rip our SHOUTcast stream for a "backup reel"): ``` ffmpeg -y -i http://geostream.cdn.shoutdrive.com:80/sd-mp3 out.mp3 ``` Rip an M3U8 (video HLS): ``` ffmpeg -i "http://on-demand.cdn.shoutdrive.com/mixes/service/2018-April-22_Thee-O/play.m3u8" -c copy -bsf:a aac_adtstoasc out.mp4 ``` --- ### Encoding / Streaming Stream a local file to an RTMP server (Periscope specification in this case): ``` ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 92k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 3250k -s 1280x720 -f flv rtmp://ca.pscp.tv:80/x/STREAM_KEY_HERE; ``` --- ### Translating / Muxing Mount RTSP as virtual video device: ``` $ ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev/video0 ``` -
acceptableEngineering renamed this gist
May 3, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
acceptableEngineering revised this gist
Jul 8, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -68,4 +68,4 @@ ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -a ``` $ ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev/video0 ``` [Source](https://superuser.com/a/1489325) -
acceptableEngineering revised this gist
Jul 8, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -68,4 +68,4 @@ ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -a ``` $ ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev/video0 ``` [Source])https://superuser.com/a/1489325) -
acceptableEngineering revised this gist
Jul 8, 2022 . 1 changed file with 10 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,20 +4,6 @@ These are FFmpeg commands I use on a regular basis and rather than keeping them For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis: --- ## Media Conversion @@ -73,4 +59,13 @@ ffmpeg -i "http://on-demand.cdn.shoutdrive.com/mixes/service/2018-April-22_Thee- ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 92k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 3250k -s 1280x720 -f flv rtmp://ca.pscp.tv:80/x/STREAM_KEY_HERE; ``` --- ## Translating / Muxing ### Mount RTSP as virtual video device ``` $ ffmpeg -f mjpeg -i rtsp://192.168.1.16/play2.sdp -pix_fmt yuv420p -f v4l2 /dev/video0 ``` (Source)[https://superuser.com/a/1489325] -
acceptableEngineering revised this gist
Jun 28, 2022 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,10 +22,9 @@ For the sake of simplicity, the filenames I use in the examples below are `in.mp ## Media Conversion ### High-Quality, Infinitely Looping GIF from MP4 ``` ffmpeg -i input.mp4 -vf "fps=12,scale=720:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif ``` ### Convert FLV to MP4 without full re-encode -
acceptableEngineering revised this gist
Apr 27, 2020 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ For the sake of simplicity, the filenames I use in the examples below are `in.mp --- ## Media Conversion ### Looping GIF from MP4 (The `scale` directive will resize it to be 1280px wide and maintain the relative matching height) @@ -35,7 +35,7 @@ ffmpeg -i in.flv -vcodec copy out.mp4 --- ## Adjustments / Processing ### Boost audio level (volume) without re-encoding ``` @@ -51,7 +51,7 @@ ffmpeg -i "in.mp4" -itsoffset 0.3 -i "in.mp4" -map 0:v -map 1:a -vcodec copy -ac --- ## Ripping ### Rip and audio stream (I use this to rip SHOUTcast streams, specifically ours) ``` @@ -67,11 +67,11 @@ ffmpeg -i "http://on-demand.cdn.shoutdrive.com/mixes/service/2018-April-22_Thee- --- ## Output / Encoding / Streaming ### Stream a local file to an RTMP server (Periscope specification) ``` ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 92k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 3250k -s 1280x720 -f flv rtmp://ca.pscp.tv:80/x/STREAM_KEY_HERE; ``` --- -
acceptableEngineering revised this gist
Apr 27, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,16 +5,16 @@ These are FFmpeg commands I use on a regular basis and rather than keeping them For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis: ## Table of Contents - [Media Conversion](#media-conversion) * [Looping GIF from MP4](#looping-gif-from-mp4) * [Convert FLV to MP4 without full re-encode](#convert-flv-to-mp4-without-full-re-encode) - [Adjustments / Processing](#adjustments---processing) * [Boost audio level (volume) without re-encoding](#boost-audio-level--volume--without-re-encoding) * [Delay audio](#delay-audio) - [Ripping](#ripping) * [Rip and audio stream (I use this to rip SHOUTcast streams, specifically ours)](#rip-and-audio-stream--i-use-this-to-rip-shoutcast-streams--specifically-ours-) * [Rip an M3U8 (video HLS)](#rip-an-m3u8--video-hls-) - [Output / Encoding / Streaming](#output---encoding---streaming) * [Stream a local file to an RTMP server (Periscope specification)](#stream-a-local-file-to-an-rtmp-server--periscope-specification-) -
acceptableEngineering revised this gist
Apr 27, 2020 . 1 changed file with 49 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,77 @@ ## Description These are FFmpeg commands I use on a regular basis and rather than keeping them to myself I figured it'd be good to share! For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis: ## Table of Contents - [Media Conversion:](#media-conversion-) * [Looping GIF from MP4](#looping-gif-from-mp4) * [Convert FLV to MP4 without full re-encode](#convert-flv-to-mp4-without-full-re-encode) - [Adjustments / Processing:](#adjustments---processing-) * [Boost audio level (volume) without re-encoding](#boost-audio-level--volume--without-re-encoding) * [Delay audio](#delay-audio) - [Ripping:](#ripping-) * [Rip and audio stream (I use this to rip SHOUTcast streams, specifically ours)](#rip-and-audio-stream--i-use-this-to-rip-shoutcast-streams--specifically-ours-) * [Rip an M3U8 (video HLS)](#rip-an-m3u8--video-hls-) - [Output / Encoding / Streaming:](#output---encoding---streaming-) * [Stream a local file to an RTMP server (Periscope specification)](#stream-a-local-file-to-an-rtmp-server--periscope-specification-) --- ## Media Conversion: ### Looping GIF from MP4 (The `scale` directive will resize it to be 1280px wide and maintain the relative matching height) ``` ffmpeg -i input.mp4 -vf "fps=10,scale=1280:-1" -loop 1 output.gif ``` ### Convert FLV to MP4 without full re-encode ``` ffmpeg -i in.flv -vcodec copy out.mp4 ``` --- ## Adjustments / Processing: ### Boost audio level (volume) without re-encoding ``` ffmpeg -i in.mp4 -vcodec copy -af "volume=10dB" out.mp4 ``` --- ### Delay audio ``` ffmpeg -i "in.mp4" -itsoffset 0.3 -i "in.mp4" -map 0:v -map 1:a -vcodec copy -acodec copy "out.mp4" ``` --- ## Ripping: ### Rip and audio stream (I use this to rip SHOUTcast streams, specifically ours) ``` ffmpeg -y -i http://geostream.cdn.shoutdrive.com:80/sd-mp3 out.mp3 ``` --- ### Rip an M3U8 (video HLS) ``` ffmpeg -i "http://on-demand.cdn.shoutdrive.com/mixes/service/2018-April-22_Thee-O/play.m3u8" -c copy -bsf:a aac_adtstoasc out.mp4 ``` --- ## Output / Encoding / Streaming: ### Stream a local file to an RTMP server (Periscope specification) ``` ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 92k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 3250k -s 1280x720 -f flv rtmp://ca.pscp.tv:80/x/STREAM_KEY_HERE; ``` --- -
acceptableEngineering revised this gist
Mar 6, 2020 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,12 @@ These are FFmpeg commands I use on a regular basis and rather than keeping them For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis: ## Create high-quality looping GIF from video file (The `scale` directive will resize it to be 1280px wide and maintain the relative matching height) ``` ffmpeg -i file.mov -vf "fps=10,scale=1280:-1" -loop 1 output.gif ``` ## Boost audio level (volume) without re-encoding ``` ffmpeg -i in.mp4 -vcodec copy -af "volume=10dB" out.mp4 -
acceptableEngineering revised this gist
Aug 20, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ For the sake of simplicity, the filenames I use in the examples below are `in.mp ffmpeg -i in.mp4 -vcodec copy -af "volume=10dB" out.mp4 ``` ## Convert FLV to MP4 without full re-encode ``` ffmpeg -i in.flv -vcodec copy out.mp4 ``` -
acceptableEngineering revised this gist
Jul 30, 2018 . 1 changed file with 28 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,33 @@ These are FFmpeg commands I use on a regular basis and rather than keeping them to myself I figured it'd be good to share! For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis: ## Boost audio level (volume) without re-encoding ``` ffmpeg -i in.mp4 -vcodec copy -af "volume=10dB" out.mp4 ``` ## Convert FLV to MP4 ``` ffmpeg -i in.flv -vcodec copy out.mp4 ``` ## Delay audio ``` ffmpeg -i "in.mp4" -itsoffset 0.3 -i "in.mp4" -map 0:v -map 1:a -vcodec copy -acodec copy "out.mp4" ``` ## Rip and audio stream (I use this to rip SHOUTcast streams, specifically ours) ``` ffmpeg -y -i http://geostream.cdn.shoutdrive.com:80/sd-mp3 out.mp3 ``` ## Rip an M3U8 (video HLS) ``` ffmpeg -i "http://on-demand.cdn.shoutdrive.com/mixes/service/2018-April-22_Thee-O/play.m3u8" -c copy -bsf:a aac_adtstoasc out.mp4 ``` ## Stream a local file to an RTMP server (Periscope specification) ``` ffmpeg -i FILE.mp4 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 92k -vcodec libx264 -x264-params keyint=60:no-scenecut=1 -r 30 -b:v 3250k -s 1280x720 -f flv rtmp://ca.pscp.tv:80/x/STREAM_KEY_HERE; ``` -
acceptableEngineering renamed this gist
Jul 30, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
acceptableEngineering created this gist
Jul 30, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ For the sake of simplicity, the filenames I use in the examples below are `in.mp4` and `out.mp4`, though you can use your imagination to picture `blah.mov` or `audio.wav` on a case-by-case basis: # Boost audio level (volume) without reencoding ``` ffmpeg -i in.mp4 -vcodec copy -af "volume=10dB" out.mp4 ```