Skip to content

Instantly share code, notes, and snippets.

@sandikodev
Forked from MichaelKreil/ffmpeg4matelight.sh
Created February 9, 2021 01:17
Show Gist options
  • Save sandikodev/da724d8c1063f86d053096dacf0e4dcf to your computer and use it in GitHub Desktop.
Save sandikodev/da724d8c1063f86d053096dacf0e4dcf to your computer and use it in GitHub Desktop.

Revisions

  1. @MichaelKreil MichaelKreil revised this gist Mar 11, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,9 @@ ffmpeg -r 25 -i video.mp4 -sws_flags bilinear -pix_fmt rgb24 -vf "scale=40:ih*40
    # ... and play it
    ffmpeg -re -i video.mov -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # Code is used in e.g. https://github.com/MichaelKreil/mateplay
    # Code is used in e.g. https://github.com/MichaelKreil/mateplay

    # convert video to gif by first generate a palette and then use it to generate gif:
    ffmpeg -i video.mov -vf "scale=40:ih*40/iw, crop=40:16,palettegen" -y palette.png
    ffmpeg -i video.mov -i palette.png -lavfi "scale=40:ih*40/iw, crop=40:16,fps=25[x]; [x][1:v] paletteuse" -y sequence2.gif

  2. @MichaelKreil MichaelKreil revised this gist Feb 17, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,12 @@ ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    # Mac normal
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=600:240, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    # Linux
    ffmpeg -re -video_size 600x240 -f x11grab -r 25 -i :0.0+100,200 -vf "scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337;

    # prepare video for matelight ...
    ffmpeg -r 25 -i video.mp4 -sws_flags bilinear -pix_fmt rgb24 -vf "scale=40:ih*40/iw, crop=40:16" -an -vcodec libx264 -crf 6 -preset veryslow video.mov
    # ... and play it
    ffmpeg -re -i video.mov -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    ffmpeg -re -i video.mov -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # Code is used in e.g. https://github.com/MichaelKreil/mateplay
  3. @MichaelKreil MichaelKreil revised this gist Feb 16, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,6 @@ ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5"
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=600:240, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # prepare video for matelight ...
    ffmpeg -r 25 -i video.mp4 -sws_flags bilinear -pix_fmt rgb24 -vf "scale=40:ih*40/iw, crop=40:16" -an -vcodec libx264 -crf 12 -preset veryslow video.mov
    ffmpeg -r 25 -i video.mp4 -sws_flags bilinear -pix_fmt rgb24 -vf "scale=40:ih*40/iw, crop=40:16" -an -vcodec libx264 -crf 6 -preset veryslow video.mov
    # ... and play it
    ffmpeg -re -i video.mov -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
  4. @MichaelKreil MichaelKreil revised this gist Feb 16, 2016. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,20 @@
    # Stream a video
    ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # Loop a gif
    ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # Stream webcam
    # Mac
    ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # Stream screen center (for e.g. YouTube videos)
    # Mac retina
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    # Mac normal
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=600:240, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=600:240, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -sws_flags bilinear -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # prepare video for matelight ...
    ffmpeg -r 25 -i video.mp4 -vf "scale=40:ih*40/iw, crop=40:16" -an -vcodec libx264 -crf 18 -preset veryslow video.mov
    ffmpeg -r 25 -i video.mp4 -sws_flags bilinear -pix_fmt rgb24 -vf "scale=40:ih*40/iw, crop=40:16" -an -vcodec libx264 -crf 12 -preset veryslow video.mov
    # ... and play it
    ffmpeg -re -i video.mov -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
  5. @MichaelKreil MichaelKreil revised this gist Feb 16, 2016. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,20 @@
    // Stream a video
    # Stream a video
    ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Loop a gif
    # Loop a gif
    ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Stream webcam
    // Mac
    # Stream webcam
    # Mac
    ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Stream screen center (for e.g. YouTube videos)
    // Mac retina
    # Stream screen center (for e.g. YouTube videos)
    # Mac retina
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    // Mac normal
    # Mac normal
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=600:240, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    # prepare video for matelight ...
    ffmpeg -r 25 -i video.mp4 -vf "scale=40:ih*40/iw, crop=40:16" -an -vcodec libx264 -crf 18 -preset veryslow video.mov
    # ... and play it
    ffmpeg -re -i video.mov -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
  6. @MichaelKreil MichaelKreil revised this gist Feb 15, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f ra
    // Mac
    ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Send screen center for e.g. YouTube videos
    // Stream screen center (for e.g. YouTube videos)
    // Mac retina
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    // Mac normal
  7. @MichaelKreil MichaelKreil created this gist Feb 15, 2016.
    16 changes: 16 additions & 0 deletions ffmpeg4matelight.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // Stream a video
    ffmpeg -re -i video.avi -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Loop a gif
    ffmpeg -re -ignore_loop 0 -i image.gif -vf "scale=40:ih*40/iw, crop=40:16" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Stream webcam
    // Mac
    ffmpeg -re -f avfoundation -r 30 -s 1280x720 -i "0" -vf "scale=40:ih*40/iw, crop=40:16, pp=autolevels:f, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337

    // Send screen center for e.g. YouTube videos
    // Mac retina
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=1200:480, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337
    // Mac normal
    ffmpeg -re -f avfoundation -r 25 -i "1" -vf "crop=600:240, scale=40:16, eq=1.5" -f rawvideo -vcodec rawvideo -pix_fmt rgb24 - > /dev/udp/matelight.cbrp3.c-base.org/1337