Skip to content

Instantly share code, notes, and snippets.

@kythin
Created May 26, 2014 06:54
Show Gist options
  • Select an option

  • Save kythin/e72180fe3054bddd89bf to your computer and use it in GitHub Desktop.

Select an option

Save kythin/e72180fe3054bddd89bf to your computer and use it in GitHub Desktop.

Revisions

  1. kythin created this gist May 26, 2014.
    33 changes: 33 additions & 0 deletions cap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    #!/bin/bash

    ##
    # RTMP to JPEG timelapse script
    # github.com/kythin
    #
    # Simple script to take an RTMP streaming url and save a jpeg every 10 seconds.
    #
    # Requires 'ffmpeg' and 'rtmpdump'
    # apt-get install ffmpeg rtmpdump
    #
    ##


    STREAM='STREAM ID HERE'
    RTMPURL='RTMP URL GOES HERE'
    OUTDIR='~/caps'

    TIME=$(date +"%Y%m%d_%H%M%S")

    mkdir -p $OUTDIR

    rtmpdump -v -r $RTMPURL -y $STREAM -o $OUTDIR/1.flv -B 1
    ffmpeg -i $OUTDIR/1.flv -ss 00:00:01 -an -r 1 -vframes 1 -s 800x600 -y $OUTDIR/$TIME.jpg


    echo "Waiting until next run..."
    sleep 10

    ./cap.sh


    exit;