home | info | video
Live streaming video
Pitahaya version 0.2.0 began including support for live streaming h.264 video. The browser bookmarklet is also capable of decoding a video stream in real time (more bookmarklet info). Video content encoded with Pitahaya is encoded in 'real time' and must adhere to a very specific format detailed below.
Requires: ffmpeg and node.js.
If running windows, install cygwin to run the commands on this page.

The following command will live stream the input file input.avi to YouTube. Be sure to replace the string abcd-efgh-ijkl-mnop-qrst with your youtube live streaming key found on your live dashboard page.

ffmpeg -nostats -loglevel 0 -re -i input.avi -vf \
"scale=196:110:force_original_aspect_ratio=decrease,pad=196:110:(ow-iw)/2:(oh-ih)/2" \
-ar 44100 -ac 2 -c:v huffyuv -acodec pcm_s16le -r 30 -y -f avi - \
| ffmpeg -nostats -loglevel 0 -i - -g 51 -c:a aac \
-b:a 112k -ar 44100 -ac 2 -c:v libx264 -profile:v main -level 3.2 \
-pix_fmt yuv420p -preset medium -b 64k -minrate 34k -maxrate 64k -bufsize 128k \
-tune zerolatency -flags +cgop+low_delay -f mp4 -movflags \
empty_moov+omit_tfhd_offset+frag_keyframe+default_base_moof - \
| pitahaya --tx avc \
| ffmpeg -nostats -loglevel 0 -f lavfi \
-i anullsrc=channel_layout=stereo:sample_rate=44100 -framerate 4 \
-f rawvideo -pixel_format rgba -video_size 640x360 -i - -vcodec rawvideo -pix_fmt rgba \
-r 30 -f rawvideo - | ffmpeg -f lavfi \
-i anullsrc=channel_layout=stereo:sample_rate=11025 -framerate 30 \
-f rawvideo -pixel_format rgba -video_size 640x360 -i - -shortest \
-c:v libx264 -pix_fmt yuv420p -crf 27 \
-preset slow -r 30 -g 60 -f flv \
Note that you can stream to different servers, e.g. Twitch, by replacing the rtmp url on the last line, e.g. "rtmp://hou.contribute.live-video.net/app/TWITCHSTREAMKEY"
Decoding in the browser Pitahaya encoded video can be decoded and played back in the browser using the bookmarklet.
Decoding via command line
Requires: ffmpeg, node.js, and streamlink.
Decode a video with the following command: (replace abcdefghijk with a valid youtube url path)
streamlink --quiet \
https://youtu.be/abcdefghij 360p -o - \
| ffmpeg -nostats -loglevel 0 \
-i - -vcodec rawvideo \
-pix_fmt rgba \
-r 16 -f rawvideo - \
| pitahaya --rx 360p \
| ffplay -nostats -loglevel 0 -

Encryption If you want to password protect the video transmission, add a passphrase via pitahaya --tx avc somepassphrase when encoding or pitahaya --rx 360p somepassphrase when decoding. You can also type the passphrase in the bookmarklet's input field if you want to decrypt the video in the browser.