Changes between Version 12 and Version 13 of Encode/YouTube


Ignore:
Timestamp:
Oct 3, 2014, 1:47:25 AM (5 years ago)
Author:
llogan
Comment:

remove unsubstantiated claim. could not reproduce.

Legend:

Unmodified
Added
Removed
Modified
  • Encode/YouTube

    v12 v13  
    7575=== My video colors are messed up in my computer's media player or the video sharing site I uploaded my video to. Now what? ===
    7676Add `-pix_fmt yuv420p` as an output option. Most (or perhaps all) non-FFmpeg based players do not support proper decoding of YUV 4:2:2 or YUV 4:4:4. !YouTube works however.
    77 
    78 == Notes ==
    79 
    80 [=#note1 [1]] !YouTube provides a guide to [https://support.google.com/youtube/answer/1722171?hl=en Advanced encoding settings] which, if certain recommendations are followed, will produce a video that will not be recoded after it is uploaded. More than likely, some of the recommendations have to do with Adobe's Flash player, so these may also work for other video sharing sites.
    81 
    82 The crucial options appear to be the container format (MP4) and options, the video and audio codecs, and the right profile for each codec (but with additional restrictions on the video stream). Video frame rates, resolutions, and aspect ratios, audio sample rates, and bit rates for video and audio are not crucial, so long as the video and audio codecs will encode them. !YouTube, at least, supports VBR video and audio and, with the latest Flash Player versions, Variable Frame Rate video.
    83 
    84 Note: all the following options to FFMPEG control the output file that will be uploaded. They must all ''follow'' the list of input sources on the command line.
    85 
    86 * MP4 container format
    87   * MOOV atom at the front of the file (Fast Start)
    88     * FFMPEG option: ''-movflags faststart''
    89 
    90 * Audio: AAC
    91   * Profile: Low Complexity (LC)
    92     * [[AAC|FFmpeg and AAC Encoding Guide]]
    93 
    94 * Video: H.264 AVC (FFMPEG option: ''-c:v libx264'')
    95   * Progressive scan (not interlaced)
    96     * Detect interlaced video (including field order)
    97       * [http://mediaarea.net/en/MediaInfo MediaInfo]
    98       - FFMPEG's [https://ffmpeg.org/ffmpeg-filters.html#idet idet] filter (adjust ''-ss'' and ''-frames:v'' to taste):
    99 {{{
    100 ffmpeg -y -ss 00:03:00 -i INPUT -an -frames:v 200 -vf idet -f rawvideo /dev/null  #or NUL for Windows
    101 }}}
    102       ''idet'' will output stats to your console just before FFMPEG exits.
    103     * FFMPEG de-interlacing options:
    104       * [https://ffmpeg.org/ffmpeg-filters.html#fieldmatch fieldmatch] filter to [http://en.wikipedia.org/wiki/Telecine#Reverse_telecine_.28a.k.a._inverse_telecine_.28IVTC.29.2C_reverse_pulldown.29 inverse telecine]
    105       * [https://ffmpeg.org/ffmpeg-filters.html#yadif-1 yadif] filter to de-interlace
    106     * [[FilteringGuide|FFMPEG Filtering Guide]]
    107   * Profile: High
    108     - FFMPEG option: ''-preset veryfast''[[BR]]''libx264'' will automatically set the profile to ''High.'' Selecting a preset faster than ''veryfast'' is not recommended.
    109   * Consecutive B-frames: 2
    110     * Consecutive B-frames must be limited to 2, regardless of other ''libx264'' options.
    111       * FFMPEG option: ''-bf 2''
    112   * Closed GOP, approximately half the video frame rate
    113     * The default, 12, works for 24-25 fps. For NTSC and 30 fps, select 15.
    114       * FFMPEG option: ''-g''
    115   * Chroma subsampling: 4:2:0
    116     * Translation: yuv420p
    117       * Check input file pixel format:
    118 {{{
    119 ffprobe -select_streams v -show_streams InputFile
    120 }}}
    121       * FFMPEG option: ''-pix_fmt yuv420p''
    122 
    123 Some examples:
    124 
    125 Inverse telecine a NTSC DVD rip (output video framerate will be "ntsc-film", 24000/1001):
    126 {{{
    127 ffmpeg -i input.mpg -strict experimental -c:a aac -b:a 128k -vf "fieldmatch=combmatch=full:mode=pc_n_ub, yadif=deint=interlaced, decimate" -pix_fmt yuv420p -c:v libx264 -crf 18 -preset slow -tune film -bf 2 -movflags faststart -shortest output.mp4
    128 }}}
    129 
    130 Same thing, but just de-interlace it (output video framerate will be "ntsc", 30000/1001):
    131 {{{
    132 ffmpeg -i input.mpg -strict experimental -c:a aac -b:a 128k -vf yadif -pix_fmt yuv420p -c:v libx264 -crf 18 -preset slow -tune film -g 15 -bf 2 -movflags faststart -shortest output.mp4
    133 }}}