Community
cancel
Showing results for 
Search instead for 
Did you mean: 
rasko_N_
Beginner
136 Views

Monit and Zabbix, try to restart ffmpeg script with QSV encoder

Thanks for Intel team for Media SDK. Good solution to transcode via GPU of CPU. Everything working very well.

Only one problem: when try to restart ffmpeg via monit or send remote command from ZABBIX we got error message to init MFX, if try to put command to directly to linux command line likes: node8# /etc/init.d/ch1 restart it works very well. We are tested just change in ffmpeg config file h264_qsv to libx264 we can use MONIT and Zabbix to restart.  

[h264_qsv @ 0x1fc6be0] mfx init: /dev/dri/renderD128 vaInitialize failed
[h264_qsv @ 0x1fc6be0] mfx init: /dev/dri/renderD129 fd open failed
[h264_qsv @ 0x1fc6be0] mfx init: /dev/dri/renderD130 fd open failed
[h264_qsv @ 0x1fc6be0] mfx init: /dev/dri/card0 vaInitialize failed
[h264_qsv @ 0x1fc6be0] mfx init: /dev/dri/card1 vaInitialize failed
[h264_qsv @ 0x1fc6be0] mfx init: /dev/dri/card2 fd open failed
[h264_qsv @ 0x1fc6be0] Error initializing the encoder
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

#!/bin/bash

NAME=ch1
INPUT=227.0.2.68:2068
OUTPUT=229.1.1.68:2068
SERVICE_ID=111
SERVICE_NAME=CTC
# OUTPUT2=224.22.22.22:1234

case "$1" in
start)
   if [ -e /var/run/$NAME.pid ];then
     echo $NAME is already running
    else
FFREPORT=file=/var/log/ffmpeg/$NAME.log:level=16 $NAME -re -v 40 \
 -i "udp://$INPUT?fifo_size=1000000&overrun_nonfatal=1" -nostdin -sn -map 0:p:$SERVICE_ID \
 -c:v h264_qsv -threads 0 -preset:v faster \
 -acodec libfdk_aac -b:a 92k \
 -y -r 25 -vsync 1 -async 25 \
 -b:v 900k -bufsize 900k \
 -metadata service_provider="CONNECT LLC" \
 -metadata service_name="$SERVICE_NAME" \
 -y -f mpegts -flush_packets 0 \
 "udp://$OUTPUT?fifo_buffer=5000000&overrun_nonfatal_option=1&pkt_size=1316&ttl=12" >/dev/null 2>&1 & echo $!>/var/run/$NAME.pid
   fi
   ;;
stop)
   kill `cat /var/run/$NAME.pid`
   rm /var/run/$NAME.pid
   ;;
restart)
   $0 stop
   $0 start
   ;;
status)
   if [ -e /var/run/$NAME.pid ]; then
      echo $NAME is running, pid=`cat /var/run/$NAME.pid`
   else
      echo $NAME is NOT running
      exit 1
   fi
   ;;
*)
   echo "Usage: $0 {start|stop|status|restart}"
esac

exit 0

 

0 Kudos
3 Replies
rasko_N_
Beginner
136 Views

Thanks! Problem has solved :)

gabriel_p_2
Beginner
136 Views

I have the same problem, could You share the solution ?

 

 

Br

Paralichko

rasko_N_
Beginner
136 Views

Add to config:

export LIBVA_DRIVERS_PATH=/opt/intel/mediasdk/lib64
export LIBVA_DRIVER_NAME=iHD
export MFX_HOME=/opt/intel/mediasdk
export PKG_CONFIG_PATH=/opt/intel/opencl:

 

 

Reply