Project

General

Profile

[SOLVED] Security ip cams mosaic with vaapi

Added by john i over 6 years ago

Hello,

I'm trying to convert the following command/script for running with vaapi hardware acceleration , but i can't!
Is it possible for multiple inputs?

Thank u!

@ #!/bin/bash

ffmpeg -loglevel fatal \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.80:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.81:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.82:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.83:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.84:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.85:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.86:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.87:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -i rtsp://192.168.204.88:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-filter_complex "color=s=1920x1080:c=gray [base];\
[0:v] setpts=PTS-STARTPTS, scale=637x357 [0];\
[1:v] setpts=PTS-STARTPTS, scale=637x357 [1];\
[2:v] setpts=PTS-STARTPTS, scale=637x357 [2];\
[3:v] setpts=PTS-STARTPTS, scale=637x357 [3];\
[4:v] setpts=PTS-STARTPTS, scale=637x357 [4];\
[5:v] setpts=PTS-STARTPTS, scale=637x357 [5];\
[6:v] setpts=PTS-STARTPTS, scale=637x357 [6];\
[7:v] setpts=PTS-STARTPTS, scale=637x357 [7];\
[8:v] setpts=PTS-STARTPTS, scale=637x357 [8];\
[base][0] overlay=shortest=0:x=2:y=2 [tmp1];\
[tmp1][1] overlay=shortest=0:x=642:y=2 [tmp2];\
[tmp2][2] overlay=shortest=0:x=1282:y=2 [tmp3];\
[tmp3][3] overlay=shortest=0:x=2:y=362 [tmp4];\
[tmp4][4] overlay=shortest=0:x=642:y=362 [tmp5];\
[tmp5][5] overlay=shortest=0:x=1282:y=362 [tmp6];\
[tmp6][6] overlay=shortest=0:x=2:y=722 [tmp7];\
[tmp7][7] overlay=shortest=0:x=642:y=722 [tmp8];\
[tmp8][8] overlay=shortest=0:x=1282:y=722"\
-c:v libx264 -preset ultrafast -b:v 8M -maxrate 8M -bufsize 4M -metadata service_provider=ESCAM -metadata service_name=Camera-Mosaic -f mpegts pipe:1@

Replies (4)

RE: Security ip cams mosaic with vaapi - Added by saen acro over 6 years ago

Where is hardware accelerated strings ?
https://trac.ffmpeg.org/wiki/Hardware/VAAPI
also for mosaic reduce frame rate to 15 fps.
keep in mind that mosaic use lot of memory for hardware transcoding

https://stackoverflow.com/questions/26000606/how-do-you-get-ffmpeg-to-encode-with-vaapi

RE: Security ip cams mosaic with vaapi - Added by john i over 6 years ago

Thank u, but i don't know the syntax of the command !

I can do it with one input stream and with no -filter_complex !

:)

RE: Security ip cams mosaic with vaapi - Added by saen acro over 6 years ago

https://github.com/s7sost/cinegrid
this is interesting, but need to be modified to accept live streams.

also
https://github.com/joolzg/mosaic_generator

but cannot compile give strange errors on different OS

RE: Security ip cams mosaic with vaapi - Added by john i over 6 years ago

Ok,
the following code is 3x3 mosaic vaapi ha with ffmpeg
Thank u all!

@#!/bin/bash

ffmpeg -loglevel fatal \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.80:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.81:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.82:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.83:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.84:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.85:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.86:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.87:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-rtsp_transport udp -r 25 -analyzeduration 0 -thread_queue_size 512 -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i rtsp://192.168.204.88:554/user=monitor_password=pass_channel=1_stream=0.sdp \
-filter_complex "[0:v] setpts=PTS-STARTPTS [0];\
[1:v] setpts=PTS-STARTPTS [1];\
[2:v] setpts=PTS-STARTPTS [2];\
[3:v] setpts=PTS-STARTPTS [3];\
[4:v] setpts=PTS-STARTPTS [4];\
[5:v] setpts=PTS-STARTPTS [5];\
[6:v] setpts=PTS-STARTPTS [6];\
[7:v] setpts=PTS-STARTPTS [7];\
[8:v] setpts=PTS-STARTPTS [8];\
[0][1][2]hstack=3[top];\
[3][4][5]hstack=3[mid];\
[6][7][8]hstack=3[bot];\
[top][mid][bot]vstack=3,format=nv12,hwupload,scale_vaapi=w=1920:h=1080[mosaic]"\
-map "[mosaic]" -r 25 -c:v h264_vaapi -metadata service_provider=ESCAM -metadata service_name=Camera-Mosaic -f mpegts pipe:1@
    (1-4/4)