-
Notifications
You must be signed in to change notification settings - Fork 0
/
send_video_ffmpeg.sh
30 lines (24 loc) · 1.22 KB
/
send_video_ffmpeg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
device=${1:-"/dev/video4"}
mode=${2:-notime}
size=${3:-"640x480"}
fps=${4:-30}
if [[ $mode == "time" ]]; then
ffmpeg -re -stream_loop -1 -i dog_clip.avi -r $fps \
-vf "settb=AVTB,setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)',drawtext=text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d\:3}':fontsize=27:fontcolor=yellow:x=(w-text_w):y=(h-text_h)" \
-s $size -preset ultrafast -f v4l2 $device
fi
if [[ $mode == "notime" ]]; then
ffmpeg -re -stream_loop -1 -i dog_clip.avi -r $fps \
-s $size -preset ultrafast -f v4l2 $device
fi
if [[ $mode == "nframe" ]]; then
ffmpeg -re -stream_loop -1 -i dog_clip.avi -r $fps \
-vf "drawtext=fontfile=Arial.ttf:text='%{frame_num}':start_number=1:x=(w-tw):y=(h-th):fontcolor=yellow:fontsize=50" \
-s $size -an -f v4l2 $device
fi
if [[ $mode == "frametime" ]]; then
ffmpeg -re -stream_loop -1 -i dog_clip.avi -r $fps \
-vf "settb=AVTB,setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)',drawtext=text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d\:3}':fontsize=27:fontcolor=yellow:x=(w-text_w):y=(h-text_h),drawtext=text='%{frame_num}':start_number=1:x=1:y=1:fontcolor=yellow:fontsize=50" \
-s $size -an -f v4l2 $device
fi