Changes between Version 8 and Version 9 of Encode/YouTube


Ignore:
Timestamp:
Mar 11, 2014, 8:02:51 AM (6 years ago)
Author:
llogan
Comment:

remove superflous examples and add better filtering example

Legend:

Unmodified
Added
Removed
Modified
  • Encode/YouTube

    v8 v9  
    66
    77== Basic Examples ==
    8 Re-encode the video and copy the audio. The output should be a similar quality as the input and will hopefully be a more manageable size.
     8
     9Re-encode the video and [http://ffmpeg.org/ffmpeg.html#Stream-copy stream copy] the audio. The output should be a similar quality as the input and will hopefully be a more manageable size.
    910{{{
    10 ffmpeg -i input -c:v libx264 -preset slow -crf 18 -c:a copy -pix_fmt yuv420p output.mkv
     11ffmpeg -i input.avi -c:v libx264 -preset slow -crf 18 -c:a copy -pix_fmt yuv420p output.mkv
    1112}}}
    1213
    13 Same as above, but also re-encode the audio instead of copying it:
     14Same as above, but also re-encode the audio instead of stream copying it:
    1415{{{
    15 ffmpeg -i input -c:v libx264 -preset slow -crf 18 -c:a libvorbis -q:a 5 -pix_fmt yuv420p output.mkv
     16ffmpeg -i input.mov -c:v libx264 -preset slow -crf 18 -c:a libvorbis -q:a 5 -pix_fmt yuv420p output.mkv
    1617}}}
    1718
     
    2021ffmpeg -loop 1 -r 2 -i input.png -i audio.ogg -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p output.mkv
    2122}}}
    22 Create a video from lossless audio file (`audio.flac`) and a still image (`720.png`): (Please note that the image needs to be 1280x720 or 1920x1080). The advantage of this method is that transcoding happens only once to the audio.
     23
     24
     25== Using filters ==
     26
     27You can use filters to create effects and to add text. This example will use the [https://ffmpeg.org/ffmpeg-filters.html#avectorscope avectorscope], [https://ffmpeg.org/ffmpeg-filters.html#showspectrum showspectrum], and [https://ffmpeg.org/ffmpeg-filters.html#showwaves showwaves] filters to create effects, the [https://ffmpeg.org/ffmpeg-filters.html#overlay overlay] filter to place each effect, and the [https://ffmpeg.org/ffmpeg-filters.html#drawtext drawtext] filter to add text:
     28
     29[[Image(musicfilter.jpg)]]
     30
    2331{{{
    24 ffmpeg -loop 1 -i 720p.png -i audio.flac -shortest -c:v libx264 -preset medium -tune stillimage -c:a pcm_s16le -r 24000/1001 -pix_fmt yuv420p -crf 18 output.avi
     32ffmpeg -i input.mp3 -filter_complex \
     33"[0:a]avectorscope=s=640x518,pad=1280:720[vs]; \
     34 [0:a]showspectrum=mode=separate:color=intensity:scale=cbrt:s=640x518[ss]; \
     35 [0:a]showwaves=s=1280x202:mode=line[sw]; \
     36 [vs][ss]overlay=w[bg]; \
     37 [bg][sw]overlay=0:H-h,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontcolor=white:x=10:y=10:text='\"Song Title\" by Artist'[out]" \
     38-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy output.mkv
    2539}}}
    26 
    27 == Examples with `drawtext` ==
    28 Create a video with a colored background using the [[http://ffmpeg.org/ffmpeg.html#color_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-testsrc|color]] video source and add text with the [[http://ffmpeg.org/ffmpeg.html#drawtext-1|drawtext]] filter showing song title:
    29 {{{
    30 ffmpeg -f lavfi -i color=c=orange:s=1280x720:r=2 -i audio.ogg -c:v libx264 \
    31 -preset medium -tune stillimage -crf 18 -vf "drawtext=fontfile=Vera.ttf: \
    32 text='Song Title'" -c:a copy -shortest output.mkv
    33 }}}
    34 
    35   '''Note:''' `fontfile` requires the full path to the font file, such as `/usr/share/fonts/TTF/Vera.ttf`.
    36 
    37 Same as above, but embiggen the text, color it yellow, and put it in a blue box with 80% opacity, and center it:
    38 {{{
    39 ffmpeg -f lavfi -i color=c=orange:s=1280x720:r=2 -i audio.wav -c:v libx264 \
    40 -preset medium -tune stillimage -crf 18 -vf "drawtext=fontfile=Vera.ttf: \
    41 fontsize=48: fontcolor=yellow@0.8: box=1: boxcolor=blue@0.8: text='Song Title': \
    42 x=(w-text_w)/2: y=(h-text_h)/2" -c:a copy -shortest output.mkv
    43 }}}
    44 
    45 Position the text on the bottom right:
    46 {{{
    47 ffmpeg -f lavfi -i color=c=orange:s=1280x720:r=2 -i audio.wav -c:v libx264 \
    48 -preset medium -tune stillimage -crf 18 -vf "drawtext=fontfile=Vera.ttf: \
    49 text='Song Title': x=w-text_w-line_h: y=h-text_h-line_h" -c:a copy -shortest output.mkv
    50 }}}
    51 
    52 Same as above, and use another `drawtext` to add author name:
    53 {{{
    54 ffmpeg -f lavfi -i color=c=orange:s=1280x720:r=2 -i audio.wav -c:v libx264 \
    55 -preset medium -tune stillimage -crf 18 -vf "drawtext=fontfile=Vera.ttf: \
    56 text='Song Title': x=w-text_w-ascent: y=h-text_h-(line_h*2),drawtext=fontfile=Vera.ttf: \
    57 text='Artist Name': x=w-text_w-ascent: y=h-text_h-line_h" -c:a copy -shortest output.mkv
    58 }}}
    59 
    60 Use the [[http://ffmpeg.org/ffmpeg.html#mandelbrot|mandelbrot]] filter instead of a boring colored background:
    61 {{{
    62 ffmpeg -f lavfi -i mandelbrot=s=1280x720:r=ntsc -i audio.mp3 -c:v libx264 \
    63 -preset medium -crf 18 -vf "drawtext=fontfile=Vera.ttf:text='Song Title'" \
    64 -c:a copy -shortest output.mkv
    65 }}}
    66 
    67 Other interesting video sources to try include `cellauto`, `testsrc`, and `life`. See [[FancyFilteringExamples|Fancy Filtering Examples]].
    6840
    6941== FAQ ==