Skip to content

Instantly share code, notes, and snippets.

@ezlibs-com
Forked from mikoim/README.md
Created January 8, 2020 03:26
Show Gist options
  • Select an option

  • Save ezlibs-com/f75d4390012f5a4b44bb8633e981b37b to your computer and use it in GitHub Desktop.

Select an option

Save ezlibs-com/f75d4390012f5a4b44bb8633e981b37b to your computer and use it in GitHub Desktop.

Revisions

  1. @mikoim mikoim revised this gist Dec 4, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions parameters.md
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,8 @@ I tested on ffmpeg 3.2.x Hypatia.
    | -crf 18 | Variable bitrate. |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |

    ## Audio codec: AAC-LC

    | Parameter | YouTube recommends setting |
    |-----------------------------|---------------------------------------------------------|
    | -c:a aac -profile:a aac_low | AAC-LC |
  2. @mikoim mikoim revised this gist Dec 4, 2016. 3 changed files with 25 additions and 19 deletions.
    2 changes: 1 addition & 1 deletion encode.sh
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    #/bin/sh
    ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a copy output
    ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low output
    9 changes: 7 additions & 2 deletions parameters.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Parameters

    I tested on ffmpeg 3.2 Hypatia.
    I tested on ffmpeg 3.2.x Hypatia.

    ## Container: MP4

    @@ -17,4 +17,9 @@ I tested on ffmpeg 3.2 Hypatia.
    | -g 30 | Closed GOP. GOP of **half the frame rate**. |
    | -coder 1 | CABAC |
    | -crf 18 | Variable bitrate. |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |

    | Parameter | YouTube recommends setting |
    |-----------------------------|---------------------------------------------------------|
    | -c:a aac -profile:a aac_low | AAC-LC |
    | -b:a 384k | Recommended audio bitrates for uploads: Stereo 384 kbps |
    33 changes: 17 additions & 16 deletions test.log
    Original file line number Diff line number Diff line change
    @@ -1,32 +1,32 @@
    ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 5.4.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
    ffmpeg version 3.2.1-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 5.4.1 (Debian 5.4.1-3) 20161019
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
    libavutil 55. 34.100 / 55. 34.100
    libavcodec 57. 64.100 / 57. 64.100
    libavcodec 57. 64.101 / 57. 64.101
    libavformat 57. 56.100 / 57. 56.100
    libavdevice 57. 1.100 / 57. 1.100
    libavfilter 6. 65.100 / 6. 65.100
    libswscale 4. 2.100 / 4. 2.100
    libswresample 2. 3.100 / 2. 3.100
    libpostproc 54. 1.100 / 54. 1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\b.mp4':
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    encoder : Lavf57.41.100
    Duration: 01:49:48.77, start: 0.000000, bitrate: 149125 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 148951 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Duration: 00:57:34.77, start: 0.000000, bitrate: 146955 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 146781 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
    handler_name : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
    handler_name : SoundHandler
    [libx264 @ 0000000002f0d100] using SAR=1/1
    [libx264 @ 0000000002f0d100] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0000000002f0d100] profile High, level 3.2
    [libx264 @ 0000000002f0d100] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=30 keyint_min=3 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'D:\encode_b.mp4':
    [libx264 @ 0x403f240] using SAR=1/1
    [libx264 @ 0x403f240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x403f240] profile High, level 3.2
    [libx264 @ 0x403f240] 264 - core 148 r292 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=30 keyint_min=3 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'out.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    @@ -35,13 +35,14 @@ Output #0, mp4, to 'D:\encode_b.mp4':
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 60 fps, 15360 tbn, 60 tbc (default)
    Metadata:
    handler_name : VideoHandler
    encoder : Lavc57.64.100 libx264
    encoder : Lavc57.64.101 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 160 kb/s (default)
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 384 kb/s (default)
    Metadata:
    handler_name : SoundHandler
    encoder : Lavc57.64.101 aac
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
  3. @mikoim mikoim revised this gist Nov 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion parameters.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ I tested on ffmpeg 3.2 Hypatia.
    |---------------------|----------------------------|
    | -profile:v high | High Profile |
    | -bf 2 | 2 consecutive B frames |
    | -g 30 | Closed GOP. GOP of half the frame rate. |
    | -g 30 | Closed GOP. GOP of **half the frame rate**. |
    | -coder 1 | CABAC |
    | -crf 18 | Variable bitrate. |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |
  4. @mikoim mikoim revised this gist Nov 27, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions parameters.md
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,5 @@ I tested on ffmpeg 3.2 Hypatia.
    | -bf 2 | 2 consecutive B frames |
    | -g 30 | Closed GOP. GOP of half the frame rate. |
    | -coder 1 | CABAC |
    | -crf 18 | Variable bitrate. |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |
  5. @mikoim mikoim revised this gist Nov 27, 2016. No changes.
  6. @mikoim mikoim revised this gist Nov 27, 2016. 1 changed file with 47 additions and 0 deletions.
    47 changes: 47 additions & 0 deletions test.log
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    ffmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 5.4.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
    libavutil 55. 34.100 / 55. 34.100
    libavcodec 57. 64.100 / 57. 64.100
    libavformat 57. 56.100 / 57. 56.100
    libavdevice 57. 1.100 / 57. 1.100
    libavfilter 6. 65.100 / 6. 65.100
    libswscale 4. 2.100 / 4. 2.100
    libswresample 2. 3.100 / 2. 3.100
    libpostproc 54. 1.100 / 54. 1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\b.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    encoder : Lavf57.41.100
    Duration: 01:49:48.77, start: 0.000000, bitrate: 149125 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 148951 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
    handler_name : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
    handler_name : SoundHandler
    [libx264 @ 0000000002f0d100] using SAR=1/1
    [libx264 @ 0000000002f0d100] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0000000002f0d100] profile High, level 3.2
    [libx264 @ 0000000002f0d100] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=2 b_pyramid=2 b_adapt=1 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=30 keyint_min=3 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'D:\encode_b.mp4':
    Metadata:
    major_brand : isom
    minor_version : 512
    compatible_brands: isomiso2avc1mp41
    encoder : Lavf57.56.100
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 60 fps, 15360 tbn, 60 tbc (default)
    Metadata:
    handler_name : VideoHandler
    encoder : Lavc57.64.100 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 160 kb/s (default)
    Metadata:
    handler_name : SoundHandler
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
  7. @mikoim mikoim revised this gist Nov 27, 2016. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion encode.sh
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,2 @@
    #/bin/sh
    ffmpeg -i input -c:v libx264 -preset slow -coder 1 -pix_fmt yuv420p -movflags faststart -bf 2 -profile:v high -crf 18 -c:a copy output
    ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a copy output
    2 changes: 1 addition & 1 deletion parameters.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,6 @@ I tested on ffmpeg 3.2 Hypatia.
    |---------------------|----------------------------|
    | -profile:v high | High Profile |
    | -bf 2 | 2 consecutive B frames |
    | [default] | Closed GOP |
    | -g 30 | Closed GOP. GOP of half the frame rate. |
    | -coder 1 | CABAC |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |
  8. @mikoim mikoim revised this gist Nov 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion parameters.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ I tested on ffmpeg 3.2 Hypatia.

    | Parameter | YouTube recommends setting |
    |---------------------|----------------------------|
    | -movflags faststart | High Profile |
    | -profile:v high | High Profile |
    | -bf 2 | 2 consecutive B frames |
    | [default] | Closed GOP |
    | -coder 1 | CABAC |
  9. @mikoim mikoim created this gist Nov 27, 2016.
    2 changes: 2 additions & 0 deletions encode.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    #/bin/sh
    ffmpeg -i input -c:v libx264 -preset slow -coder 1 -pix_fmt yuv420p -movflags faststart -bf 2 -profile:v high -crf 18 -c:a copy output
    19 changes: 19 additions & 0 deletions parameters.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # Parameters

    I tested on ffmpeg 3.2 Hypatia.

    ## Container: MP4

    | Parameter | YouTube recommends setting |
    |---------------------|-------------------------------------------------|
    | -movflags faststart | moov atom at the front of the file (Fast Start) |

    ## Video codec: H.264

    | Parameter | YouTube recommends setting |
    |---------------------|----------------------------|
    | -movflags faststart | High Profile |
    | -bf 2 | 2 consecutive B frames |
    | [default] | Closed GOP |
    | -coder 1 | CABAC |
    | -pix_fmt yuv420p | Chroma subsampling: 4:2:0 |