Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ffmpeg [2017/05/22 11:03] (current)
sschueller created
Line 1: Line 1:
 +===== Live streaming to youtube =====
 +  - compile ffmpeg with hardware encoder
 +<code bash>
 +cd /usr/src
 +git clone https://​git.ffmpeg.org/​ffmpeg.git
 +cd ffmpeg
 +./configure --enable-omx --enable-omx-rpi --enable-libfreetype
 +make
 +make install
 +</​code>​
 +
 +Scripts
 +<code bash>
 +#!/bin/bash
 +
 +KEY=********
 +URL=rtmp://​a.rtmp.youtube.com/​live2
 +
 +while true ; do
 +
 +ffmpeg \
 +-ar 44100 -ac 2 -f s16le -i /dev/zero \
 +-thread_queue_size 512 \
 +-i /dev/video0 -f flv \
 +-framerate 30 -video_size 720x404 \
 +-vcodec h264_omx -maxrate 768k -bufsize 8080k \
 +-vf drawtext="​fontfile=DejaVuSansMono.ttf:​textfile=status.txt:​fontsize=10:​fontcolor=white:​y=main_h-(text_h*1):​reload=1"​ \
 +"​$URL/​$KEY"​
 +
 +   sleep 5
 +done
 +</​code>​
 +
 +<code bash>
 +#!/bin/bash
 +
 +DATA=$(curl -s --header "​X-Api-Key:​ *****" http://​localhost/​api/​printer)
 +
 +DATA2=$(curl -s --header "​X-Api-Key:​ *****" http://​localhost/​api/​job)
 +
 +TOOTEMP=$(echo $DATA | jq -r '​.temperature.tool0.actual'​)
 +BEDTEMP=$(echo $DATA | jq -r '​.temperature.bed.actual'​)
 +PROGRES=$(echo $DATA2 ​ | jq -r '​.progress.completion'​)
 +STATE=$(echo $DATA2 ​ | jq -r '​.state'​)
 +FINAME=$(echo $DATA2 ​ | jq -r '​.job.file.name'​)
 +PRROUND=$(echo "​$PROGRES/​1"​ | bc )
 +
 +printf " Tool: $TOOTEMP°C / Bed: $BEDTEMP°C\n State: $STATE, Progress: $PRROUND\n File: $FINAME\n"​ > status-temp.txt
 +
 +cp -f status-temp.txt status.txt
 +
 +</​code>​