Skip to content

Instantly share code, notes, and snippets.

@mpharrigan
Last active June 3, 2019 05:11
Show Gist options
  • Select an option

  • Save mpharrigan/5f10a8ea4dcb74b9c767 to your computer and use it in GitHub Desktop.

Select an option

Save mpharrigan/5f10a8ea4dcb74b9c767 to your computer and use it in GitHub Desktop.

Revisions

  1. mpharrigan revised this gist Nov 23, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 2-ffmpeg-overlay.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,8 @@ ffmpeg \
    movie.overlay.mkv

    # syntax for ffmpeg "filters" is
    # [in_stream_name] command=parameter1=value1:parameter2=value2 ;
    # [in_stream_name] command=parameter1=value1:parameter2=value2 [out_stream_name] ;
    #
    # The above takes video stream 1 [1:v] and scales it by 0.8
    # It then overlays the output of that [sclvr1] onto the vmd movie [0:v]
    # The final line rounds the whole video to have a width and height divisible
  2. mpharrigan revised this gist Nov 23, 2015. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  3. mpharrigan revised this gist Nov 23, 2015. 2 changed files with 22 additions and 1 deletion.
    19 changes: 19 additions & 0 deletions ffmpeg-overlay.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    ffmpeg \
    -framerate 90 -i vmd/final.molecule.%05d.tga \
    -framerate 90 -i plot/frame%05d.png \
    -c:v libx264 \
    -preset slow \
    -crf 18 \
    -filter_complex "\
    [1:v] scale=in_w*0.8:in_h*0.8 [sclvrl] ;\
    [0:v][sclvrl] overlay=eval='init':x=W-w-5:y=5 [overout] ;\
    [overout] scale=trunc(in_w/2)*2:trunc(in_h/2)*2" \
    movie.overlay.mkv

    # syntax for ffmpeg "filters" is
    # [in_stream_name] command=parameter1=value1:parameter2=value2 ;
    # The above takes video stream 1 [1:v] and scales it by 0.8
    # It then overlays the output of that [sclvr1] onto the vmd movie [0:v]
    # The final line rounds the whole video to have a width and height divisible
    # by 2, which is something needed by h264 (??). I think the default width for
    # vmd is an odd number.
    4 changes: 3 additions & 1 deletion ffmpeg.sh
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,6 @@ ffmpeg -i molecule.%5d.ppm -c:v libx264 -preset slow -crf 18 molecule.mkv
    # -crf quality factor, lower = better, 18 = practically lossless
    # output filename

    # For colors, make sure you're using yuv444 which should be the default in newer ffmpeg
    # For colors, make sure you're using yuv444 which should be the default in newer ffmpeg

    # Note: you can use either the vmd ppm or tga image files
  4. mpharrigan created this gist Oct 12, 2015.
    9 changes: 9 additions & 0 deletions ffmpeg.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    ffmpeg -i molecule.%5d.ppm -c:v libx264 -preset slow -crf 18 molecule.mkv

    # -i input filenames
    # -c:v codec (libx264 --> H.264)
    # -preset duh
    # -crf quality factor, lower = better, 18 = practically lossless
    # output filename

    # For colors, make sure you're using yuv444 which should be the default in newer ffmpeg