Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __COMBINING VIDEO FILES INTO ONE VIDEO__
- CONCATENATING
- ffmpeg -i "20190718_131511.mp4" -i "20190718_132801.mp4" -i "20190718_134051.mp4" -i "20190718_135341.mp4" "kitty.mp4"
- Hard-coding the Subtitles into the Video:
- 1.) converting the mp4 to uploadable mp4
- ffmpeg -i "V niin kuin ketutus english subs.mp4" "V niin kuin ketutus english subs2.mp4"
- 2.) converting the subtitle file into something useful
- ffmpeg -i "V niin kuin ketutus.en.srt" subtitles.ass
- 3.) hard-coding the subtitles to the video
- ffmpeg -i "V niin kuin ketutus english subs.mp4" -vf ass=subtitles.ass "V niin kuin ketutus english subtitles.mp4"
- = = = MOAR = = =
- ffmpeg -i "joint resolution37 amendment 13 Feb 2019 sm.mp4" -b 125k "Joint_House_Resolution_37_amendment_13_Feb_2019.mp4"
- took a 22+MB mp4 and downgraded the bitrate so that it was just over 15MB in size
- First - I looked at the file details------
- ------------------------------------------
- $ ffmpeg -i "joint resolution37 amendment 13 Feb 2019 sm.mp4"
- ffmpeg version 3.3.4-1mx17+2 Copyright (c) 2000-2017 the FFmpeg developers
- built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
- configuration: --prefix=/usr --extra-version=1mx17+2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
- libavutil 55. 58.100 / 55. 58.100
- libavcodec 57. 89.100 / 57. 89.100
- libavformat 57. 71.100 / 57. 71.100
- libavdevice 57. 6.100 / 57. 6.100
- libavfilter 6. 82.100 / 6. 82.100
- libavresample 3. 5. 0 / 3. 5. 0
- libswscale 4. 6.100 / 4. 6.100
- libswresample 2. 7.100 / 2. 7.100
- libpostproc 54. 5.100 / 54. 5.100
- Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'joint resolution37 amendment 13 Feb 2019 sm.mp4':
- Metadata:
- major_brand : mp42
- minor_version : 0
- compatible_brands: mp42mp41iso4
- creation_time : 2019-02-13T21:28:04.000000Z
- Duration: 00:07:56.82, start: 0.000000, bitrate: 375 kb/s
- Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360, 305 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60 tbc (default)
- Metadata:
- creation_time : 2019-02-13T21:28:04.000000Z
- handler_name : Vireo Eyes v2.4.28
- encoder : AVC Coding
- Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 65 kb/s (default)
- Metadata:
- creation_time : 2019-02-13T21:28:04.000000Z
- handler_name : Vireo Ears v2.4.28
- At least one output file must be specified
- -----You see that? Bitrate is 375k? -----
- ------------------------------------------
- So, I dropped the bitrate down to 125k and changed the filename a little
- $ ffmpeg -i "joint resolution37 amendment 13 Feb 2019 sm.mp4" -b 125k "Joint_House_Resolution_37_amendment_13_Feb_2019.mp4"
- Now doing the same thing except I want to convert it to webm
- $ ffmpeg -i "joint resolution37 amendment 13 Feb 2019 sm.mp4" -b 125k "Joint_House_Resolution_37_amendment_13_Feb_2019.webm"
- Its taking a much longer time.
- $ ffmpeg -i Joint_House_Resolution_37_amendment_13_Feb_2019.mp4 -b 125k -ac 1 -ar 32000 -ab 96 Joint_House_Resolution_37_amendment_13_Feb_2019_Smaller.mp4
- (-b 125K reduces video bitrate to 125K)
- (-ac 1 (one) : converts stereo to mono)
- (-ab 96 : reduces audio bitrate to 96)
- (-ar 32000 : reduces the 44100 to 32000)
- -filter:v scale=1280:720 -c:a copy ---- scaling
- or
- -s 1280x720 -c:a copy
- The following command will compress and reduce the output file’s size.
- $ ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4
- Please note that you will lose the quality if you try to reduce the video file size. You can lower that crf value to 23 or lower if 24 is too aggressive.
- You could also transcode the audio down a bit and make it stereo to reduce the size by including the following options.
- -ac 2 -c:a aac -strict -2 -b:a 128k
- ------------------------------------------
- ------------------------------------------
- ------------------------------------------
- https://www.ostechnix.com/20-ffmpeg-commands-beginners/
- ffmpeg -i filename.ext ---- just gives details about the file
- - - - - - - - - -
- Adding a picture to an audio file
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i albumart.jpg -i "08 - Into The Void.mp3" -c:v libx264 -c:a aac -strict experimental -b:a 128k -shortest output.mp4
- ==to vp8 under 8GB==
- ==example:
- == ffmpeg -i Hi_Stranger.mp4 -c:v libvpx -c:a libvorbis -s 480:270 -ab 80k -b:v 150k -ar 24000 Hi_Stranger_480x270.webm
- == ffmpeg -loop 1 -i albumart.jpg -i "08 - Into The Void.mp3" -s 200:200 -c:v libvpx -c:a libvorbis -strict experimental -b:a 128k -shortest Black_Sabbath_Into_The_Void_200x200.webm
- == it looks like its working
- a 6:11 song intu 7,984 kb - 7.9 Mb
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
- works - image and mp3 to mp4
- ffmpeg -r 1 -i cdc_logo.png -i t0221-cdc-telebriefing-covid-19.mp3 -ac 1 -b:a 45K -c:v libx264 -b 50k -c:a aac -strict experimental 21_feb_2020_cdc_brief.mp4
- - - - - - - - - -
- ## started with 28.9 Mb filesize
- Duration: 00:08:38.50, start: -0.007000, bitrate: 445 kb/s
- Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, bt709), 1280x720, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
- Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default
- ## converter command
- $ ffmpeg -i "Demographic Hypocrisy-A19oaNXrapE.webm" -b:v 125k -ac 1 -ab 96k -ar 24000 -s 544:306 "Demographic_Hypocrisy_from_Know_More_News_Youtube.webm"
- ## thinking that this might reduce it below 16Mb)
- ## 2:30 = 5Mb
- ## 38 sec = 0.633333333333
- ## calculations say 17.26 Mb
- came out as 17.6 Mb
- trying to only resize to 544 x 306
- - - - - - - - - -
- List of perfect 16:9 ratios
- 1920 x 1080
- 1904 x 1071
- 1888 x 1062
- 1872 x 1053
- 1856 x 1044
- 1840 x 1035
- 1824 x 1026
- 1808 x 1017
- 1792 x 1008
- 1776 x 999
- 1760 x 990
- 1744 x 981
- 1728 x 972
- 1712 x 963
- 1696 x 954
- 1680 x 945
- 1664 x 936
- 1648 x 927
- 1632 x 918
- 1616 x 909
- 1600 x 900
- 1584 x 891
- 1568 x 882
- 1552 x 873
- 1536 x 864
- 1520 x 855
- 1504 x 846
- 1488 x 837
- 1472 x 828
- 1456 x 819
- 1440 x 810
- 1424 x 801
- 1408 x 792
- 1392 x 783
- 1376 x 774
- 1360 x 765
- 1344 x 756
- 1328 x 747
- 1312 x 738
- 1296 x 729
- 1280 x 720
- 1264 x 711
- 1248 x 702
- 1232 x 693
- 1216 x 684
- 1200 x 675
- 1184 x 666
- 1168 x 657
- 1152 x 648
- 1136 x 639
- 1120 x 630
- 1104 x 621
- 1088 x 612
- 1072 x 603
- 1056 x 594
- 1040 x 585
- 1024 x 576
- 1008 x 567
- 992 x 558
- 976 x 549
- 960 x 540
- 944 x 531
- 928 x 522
- 912 x 513
- 896 x 504
- 880 x 495
- 864 x 486
- 848 x 477
- 832 x 468
- 816 x 459
- 800 x 450
- 784 x 441
- 768 x 432
- 752 x 423
- 736 x 414
- 720 x 405
- 704 x 396
- 688 x 387
- 672 x 378
- 656 x 369
- 640 x 360
- 624 x 351
- 608 x 342
- 592 x 333
- 576 x 324
- 560 x 315
- 544 x 306
- 528 x 297
- 512 x 288
- 496 x 279
- 480 x 270
- 464 x 261
- 448 x 252
- 432 x 243
- 416 x 234
- 400 x 225
- 384 x 216
- 368 x 207
- 352 x 198
- 336 x 189
- 320 x 180
- 304 x 171
- 288 x 162
- 272 x 153
- 256 x 144
- 240 x 135
- 224 x 126
- 208 x 117
- 192 x 108
- 176 x 99
- 160 x 90
- 144 x 81
- 128 x 72
- 112 x 63
- 96 x 54
- 80 x 45
- 64 x 36
- 48 x 27
- 32 x 18
- 16 x 9
- - - - - - - - - -
- --------------------------------------
- --------------------------------------
- --------------------------------------
- Download Youtube Playlist (mp4 formats)
- $ youtube-dl -i -f mp4 --yes-playlist 'https://www.youtube.com/watch?v=A9ibhWgMlso&list=PLk7MlpewRSRnzt6NrygRlgJn6S9U34wOp'
- THEN
- BATCH CONVERT
- FROM mp4 to mp3
- $ for i in *.mp4; do ffmpeg -i "$i" "${i%.*}.mp3"; done
- $ for i in *.webp; do ffmpeg -i "$i" "${i%.*}.png"; done
- $ for i in *.m4a; do ffmpeg -i "$i" "${i%.*}.mp3"; done
- for i in *.png; do ffmpeg -i "$i" "${i%.*}.tif"; done
- ::: Note - could not download playlist directly to mp3s yet :::
- --------------------------------------
- --------------------------------------
- --------------------------------------
- Here are the properties for a 29-minute video under 15 Mb:
- --------------------------------------
- Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ForensicProof_2ndShooter_LasVegas.mp4':
- Metadata:
- major_brand : isom
- minor_version : 512
- compatible_brands: isomiso2avc1mp41
- encoder : Lavf57.83.100
- Duration: 00:29:09.25, start: 0.000000, bitrate: 70 kb/s
- Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 44 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
- Metadata:
- handler_name : VideoHandler
- Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 18 kb/s (default)
- Metadata:
- handler_name : SoundHandler
- so,
- ffmpeg -i filename.mp4 -b:v 70k -ac 1 -ab 18k -ar 24000 -s 640:360 filename.webm ------ but I'm sure there's more
- --------------------------------------
- --------------------------------------
- --------------------------------------
- FIXED ASPECT FROM 4:3 to 16:9
- $ ffmpeg -i "Dr. James Johnson Demographic Realities The Browning and Graying of America.mp4" -aspect 16:9 "Dr. James Johnson Demographic Realities The Browning and Graying of America fixed.mp4"
- ==Original File:============
- Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Dr. James Johnson Demographic Realities The Browning and Graying of America.mp4':
- Metadata:
- major_brand : mp42
- minor_version : 0
- compatible_brands: isommp42
- creation_time : 2017-06-16T15:02:27.000000Z
- Duration: 00:54:17.25, start: 0.000000, bitrate: 350 kb/s
- Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 252 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
- Metadata:
- handler_name : VideoHandler
- Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s (default)
- Metadata:
- creation_time : 2017-06-16T15:02:40.000000Z
- handler_name : IsoMedia File Produced by Google, 5-11-2011
- ===========================
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- vp8 webm for 4 chan
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- 1.) -an -c:v libvpx -b:v 1M -c:a libvorbis (Don't remember if that worked,)
- but this did:
- 2.) ffmpeg -i Hi_Stranger.mp4 -c:v libvpx -c:a libvorbis -s 480:270 -ab 80k -b:v 150k -ar 24000 Hi_Stranger_480x270.webm
- that is WITH AUDIO
- -an is added to remove audio
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- ffmpeg -i VIDEO1.mp4 -s 640:360 -ac 1 -ab 96k -b:v 200k -ar 24000 VIDEO1.webm
- converted a 5:49.39 1280x720 26.8 MiB to 640x360 13.7 Mb
- -r 30 = 30 fps
- burned the subtitles in with::: -vf subtitles=subtitle.srt ::: same settings with everything else, and
- ffmpeg -i Tucker_6_Dec_2019_HR_5038_b.webm -s 640:360 -ac 1 -ab 96k -b:v 200k -ar 24000 Tucker_6_Dec_2019_HR_5038_c.webm
- -----------------------------
- Input #0, matroska,webm, from 'Tucker_6_Dec_2019_HR_5038_b.webm':
- Metadata:
- ENCODER : Lavf58.20.100
- Duration: 00:06:41.80, start: 0.000000, bitrate: 2665 kb/s
- Stream #0:0: Video: vp8, yuv420p(bt709/unknown/bt709, progressive), 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
- Metadata:
- DURATION : 00:06:41.804000000
- Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)
- Metadata:
- DURATION : 00:06:41.759000000
- Stream mapping:
- Stream #0:0 -> #0:0 (vp8 (native) -> vp9 (libvpx-vp9))
- Stream #0:1 -> #0:1 (vorbis (native) -> opus (libopus))
- Press [q] to stop, [?] for help
- [libvpx-vp9 @ 0x55732a81fd00] v1.7.0
- Output #0, webm, to 'Tucker_6_Dec_2019_HR_5038_c.webm':
- Metadata:
- encoder : Lavf58.20.100
- Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 29.97 fps, 1k tbn, 29.97 tbc (default)
- Metadata:
- DURATION : 00:06:41.804000000
- encoder : Lavc58.35.100 libvpx-vp9
- Side data:
- cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
- Stream #0:1: Audio: opus (libopus), 24000 Hz, mono, flt, 96 kb/s (default)
- Metadata:
- DURATION : 00:06:41.759000000
- encoder : Lavc58.35.100 libopus
- -----------------------------
- I'm converting it to vp9
- should have added
- -c:v libvpx
- I may get the chance to - the video doesn't look like its going to be under 16MB
- also
- shrink it to 480 x 270
- ffmpeg -i Tucker_6_Dec_2019_HR_5038_b.webm -c:v libvpx -s 480:270 -ac 1 -ab 96k -b:v 200k -ar 24000 Tucker_6_Dec_2019_HR_5038_d.webm
- -----------------------------
- ffmpeg -i Farrakhan_on_LeBron_James_and_Jewish_Control_July_11_2010.mp4 -s 320:240 -ac 1 -ab 50k -b:v 100k -ar 12000 Farrakhan_on_LeBron_James_and_Jewish_Control_July_11_2010.webm
- 35.7 Mb to 12.3 Mb (4:3 ratio)
- -----------------------------
- 4:3 video
- https://www.videoproc.com/video-process/4-3-resolutions.htm
- Change the Aspect Ratio
- ffmpeg -i xxxxxx.mp4 -aspect 400:300 xxxxxx_400x300.mp4
- 1.5 ratio
- 720:480
- 600:400
- 480:320
- -s 640:360 -c:v libvpx -ac 1
- -------
- downscale
- ffmpeg -i input_1280x720.mp4 -vf scale=640x480:flags=lanczos -c:v libx264 -preset slow -crf 21 output_compress_640x480p.mp4
- -------------
- changing the framerate to 30 fps
- ffmpeg -i <input> -filter:v fps=fps=30 <output>
- -------------
- one command to change the resolution of a video:
- ffmpeg -i input.mp4 -vf scale=-1:720 output.mp4
- -------------
- Lower the quality of H264 but keep it in H264 format
- Start
- Resolution: 1920 x 1080
- Frames Per Second: 60
- Video Format: ITU H.264
- Audio Format: MPEG 1 Audio, Layer 3 (MP3)
- (Incomplete)
- To test audio quality simply use the name of the audio file as follows:
- $ ffplay audio_filename1.mp3
- To compare videos and audios after converting you can use the commands below. This helps you to test videos and audio quality.
- $ ffplay video1.mp4
- 4chins vp8
- -c:v libvpx -c:a libvorbis -s 480:270 -ab 80k -b:v 150k -ar 24000
- -c:v libvpx -c:a libvorbis -s 320:180 -ab 80k -b:v 150k -ar 24000
- Pandemic is Over Lies exposed Agendas Revealed by Pfizer Chief Scientific Advisor-TMGJRV-u_ts_f136_640x360.webm
- ----------------------------
- Splitting up video into timed chunks:
- ffmpeg -i input.mp4 -c copy -map 0 -segment_time 00:04:00 -f segment output%03d.mp4
- or
- ffmpeg -i input.mp4 -ss 00:00:00 -to 00:04:00 -c copy output1.mp4
- ffmpeg -i input.mp4 -ss 00:04:00 -to 00:08:00 -c copy output2.mp4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement