[Home]Encoding For YouTube

Showing revision 16
Work in progress.

youtube transcodes whatever you give them into something their flash player will play. They will downsample/res/everything if what you give them is too big, so best to try and tune the parameters under your control to minimize quality loss when they do their pass.

What I have so far:

find ./ -name *.dv -exec \
  transcode -threads 2 \
     -i {} -x dv,null -o tc/a{}.mpg \
     -y ffmpeg,null -F h264 --encode_fields p \
     --frame_interval 400 -J fps=29:1:pre

avimerge -i [01]*.mpg cap/*.mpg -A 0 -o x.mpg
http://www.youtube.com/watch?v=zzrTf6lZHUI

transcode  \
        --encode_fields p \
        -i PyGamePySightHQ.mov \
        -o ~/a/$ONAME \
        -m aud \
        -y mov,mov \
        -k \
        -Z 1280x,fast \
        --import_asr 2 \
        -F x264,faac,x264_i_rc_method="Average bitrate":x264_i_bitrate=6000 \
http://www.youtube.com/watch?v=EGSgLuxrgYc&fmt=22

transcode  \
         --encode_fields p \
        -i PyGamePySightHQ.mov \
        -g 640x480 \
        -f 29.970,4 \
        -a 0 \
        -e 48000,16,2 \
        -n 0x1 \
        -o  ~/a/test.avi \
        -V rgb24 \
        -y ffmpeg,tcaud \
        -F h264 \
        -Z 480x360 \
        -w 1500 \
        --export_fps 30,5 \
        -b 44,0,9,2 \
        -c 0-0:0:10


notes I have collected:

Best Formats for Uploading

YouTube can accept almost any video format for upload, but for most users we have found the following settings give the best results.

    * Video Format: MPEG4 (Divx, Xvid)
    * Resolution: 640x480 pixels
    * Audio Format: MP3
    * Frames per second: 30
    * Maximum length: 10 minutes (we recommend 2-3 minutes)
    * Maximum file size: 1 GB

http://www.youtube.com/handbook_popup_produce_upload?pcont=bestformats

Your uploaded video must have a playback speed of 1.4 mbps or greater to generate the high quality viewing option. YouTube needs a minimum of 24fps to trigger the HQ encoding.

Try these for starters:
Set the video size to 480x360
frame rate to 24
Video bit rate 1500k <-- High bitrate because of the small gop size. See the keyframe interval comment.
Buffer 3 <-- What does that mean?
Video Smoothness: 95 <-- I assume this means nr=95
Keyframe interval: 10 <-- Apparently even a keyframe intreval of 3 would not be unheard of - This because frames are often dropped when streaming. - Phil Ehrens

http://help.youtube.com/group/youtube-howto/browse_thread/thread/f9f139b032e78629/9770e350c7804a50?lnk=gst&q=codec#9770e350c7804a50

320x240. bitrate for the video is 300 kbp/s. bitrate for the audio is 64 kbp/s mono mp3. if they use 320x240 then why the hell do they play it back at 425x350? Videobitrates are around 260 kbps, Audio is encoded to around 56 kbps, monophonic, 22050 Hz mpeg3. The enconder they use is FLV1 Flash/Sorensen http://blogs.chron.com/makingmovies/archives/2006/04/youtube_and_the.html

Two email list ramblings from Phil Ehrens:

What would be best would be something that has the same
resolution as the youtube content, and that has had the
higher frequency components cut off. That said, I suspect
that using lavc mpeg4 2-pass with nr just high enough so
that things begin to soften would be best. That way there's
nothing that will be a challenge for the awful encoder that
youtube will throw at it... No scaling required and no
wide peaks to get chopped off.

According to a friend of mine, I'm totally wrong...
He says that if you encode targeting the ipod/iphone
that YouTube will not reencode it. He says that this
is a new unstated policy. I have no idea whether he
is 100% correct, but he is not prone to making the same
kind of unsupported and unverifiable statements that
I am ;^)

ffmpeg -i input_file \
-f mp4 -vcodec mpeg4 \
-maxrate 1000k -b 700k -qmin 3 -qmax 5 -bufsize 4096 -g 300 \
-acodec aac -ab 192 \
-s 320x240 -aspect 4:3 output_file_name.mov

"encode targeting the ipod/iphone" - anyone know what parameters that is?
according to formatpresets.C of HV's cinelerra version:

audio_channels = 1;
audio_tracks = 1;
sample_rate = 48000;
video_channels = 1;
video_tracks = 1;
frame_rate = (double)30000.0 / 1001;
output_w = 424;
output_h = 318;
aspect_w = 4;
aspect_h = 3;


Transcode Wiki | Recent Changes | Preferences
Password required to edit | View other revisions | View current revision
Edited December 21, 2008 12:03 am by CarlKarsten (diff)
Search: