Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6490 Discussions

Dlstreamer_Gst : How to write the output to a file in a pipeline

NikhilParmar
Novice
3,766 Views

I have been testing with the DLStreamer Examples and for the experiment. I want to dump the results in a file but unable to do that.

 

For this pipeline :

 

GST_PLUGIN_PATH=/opt/intel/openvino/data_processing/dl_streamer/lib:/opt/intel/openvino/data_processing/gstreamer/lib/gstreamer-1.0
filesrc location=/tmp/.X11-unix/vault_video_1.mp4 ! decodebin !     videoconvert n-threads=4 ! capsfilter caps="video/x-raw,format=BGRx" !     gvadetect model=/root/intel/dl_streamer/models/intel/face-detection-adas-0001/FP32/face-detection-adas-0001.xml device=CPU ! queue !     gvainference model=/root/intel/dl_streamer/models/intel/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013.xml device=CPU inference-region=roi-list ! queue !     gvainference model=/root/intel/dl_streamer/models/intel/emotions-recognition-retail-0003/FP32/emotions-recognition-retail-0003.xml device=CPU inference-region=roi-list ! queue !     gvainference model=/root/intel/dl_streamer/models/intel/facial-landmarks-35-adas-0002/FP32/facial-landmarks-35-adas-0002.xml device=CPU inference-region=roi-list ! queue !     gvawatermark name=gvawatermark ! videoconvert n-threads=4 !     gvafpscounter ! filesink location=/tmp/.X11-unix/test.avi

 

 This generates a file in GB. And for a regular file when I try to add encoder, unable to install that in the docker.

This testing I am doing inside a docker container. How to create a pipeline to dump results into a .mp4 or .avi file.

Labels (2)
0 Kudos
8 Replies
Wan_Intel
Moderator
3,726 Views

Hi NikhilParmar,


Thank you for reaching out to us.


We are investigating this issue and will update you at the earliest.


Regards,

Wan


0 Kudos
Wan_Intel
Moderator
3,710 Views

Hi NikhilParmar,

 

I have successfully written the output to a file (.mov or .avi) for Vehicle and Pedestrian Tracking Sample using Intel® Distribution of OpenVINO™ toolkit Docker image for Ubuntu* 18.04 LTS inside a docker container.

 

To dump results into a .mov or .avi file, you must add the following GStreamer plugin into the pipeline:

 

Option 1 - create .mov file by adding qtmux:

gst-launch-1.0 urisourcebin buffer-size=4096 uri=https://github.com/intel-iot-devkit/sample-videos/raw/master/person-bicycle-car-detection.mp4 ! decodebin ! video/x-raw ! queue ! gvadetect model=/home/ust/intel/dl_streamer/models/intel/person-vehicle-bike-detection-crossroad-0078/FP32/person-vehicle-bike-detection-crossroad-0078.xml model-proc=./model_proc/person-vehicle-bike-detection-crossroad-0078.json inference-interval=10 threshold=0.6 device=CPU ! queue ! gvatrack tracking-type=short-term ! queue ! gvaclassify model=/home/ust/intel/dl_streamer/models/intel/person-attributes-recognition-crossroad-0230/FP32/person-attributes-recognition-crossroad-0230.xml model-proc=./model_proc/person-attributes-recognition-crossroad-0230.json reclassify-interval=10 device=CPU object-class=person ! queue ! gvaclassify model=/home/ust/intel/dl_streamer/models/intel/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml model-proc=./model_proc/vehicle-attributes-recognition-barrier-0039.json reclassify-interval=10 device=CPU object-class=vehicle ! queue ! gvawatermark ! videoconvert ! qtmux ! filesink location=/tmp/output.mov

 

Option 2 - create .avi file by adding avimux:

gst-launch-1.0 urisourcebin buffer-size=4096 uri=https://github.com/intel-iot-devkit/sample-videos/raw/master/person-bicycle-car-detection.mp4 ! decodebin ! video/x-raw ! queue ! gvadetect model=/home/ust/intel/dl_streamer/models/intel/person-vehicle-bike-detection-crossroad-0078/FP32/person-vehicle-bike-detection-crossroad-0078.xml model-proc=./model_proc/person-vehicle-bike-detection-crossroad-0078.json inference-interval=10 threshold=0.6 device=CPU ! queue ! gvatrack tracking-type=short-term ! queue ! gvaclassify model=/home/ust/intel/dl_streamer/models/intel/person-attributes-recognition-crossroad-0230/FP32/person-attributes-recognition-crossroad-0230.xml model-proc=./model_proc/person-attributes-recognition-crossroad-0230.json reclassify-interval=10 device=CPU object-class=person ! queue ! gvaclassify model=/home/ust/intel/dl_streamer/models/intel/vehicle-attributes-recognition-barrier-0039/FP32/vehicle-attributes-recognition-barrier-0039.xml model-proc=./model_proc/vehicle-attributes-recognition-barrier-0039.json reclassify-interval=10 device=CPU object-class=vehicle ! queue ! gvawatermark ! videoconvert ! avimux name=mux ! filesink location=/tmp/output.avi

 

For more information on GStreamer Plugins, please visit the following page:

https://gstreamer.freedesktop.org/documentation/plugins_doc.html?gi-language=c#plugins

 

Best regards,

Wan

 

0 Kudos
Maksim_S_Intel
Employee
3,689 Views

avimux name=mux ! filesink location=/tmp/output.avi

Wouldn't it result in uncompressed video written to the output file? File size will be huge in this case. Shouldn't it include encoding element (e.g. x264enc) before mux?

0 Kudos
NikhilParmar
Novice
3,674 Views

Hi @Maksim_S_Intel,

You are right! As mentioned by me in the original pipeline, the file size without the encoder is big, and the encoder plugin is not available in the docker image.

Can you check if the `x264enc` is available in the docker image?

0 Kudos
Maksim_S_Intel
Employee
3,657 Views

Looks like x264enc is not included in dl_streamer, but there is HW-accelerated VAAPI codecs, e.g. vaapih264enc:

gst-launch-1.0 \
videotestsrc num-buffers=1000 \
! video/x-raw,format=BGR,width=1920,height=1080 \
! videoconvert \
! vaapih264enc \
! h264parse \
! mp4mux \
! filesink sync=false location=test.mp4

 Make sure your container has access to GPU, see https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_docker_linux.html#run_the_docker_image_for_gpu

0 Kudos
NikhilParmar
Novice
3,635 Views

Hi @Maksim_S_Intel ,

Thanks for the update. Unfortunately, I have access to Ubuntu VM with CPU and NS2 with Raspberrypi in both the combinations. I can not test this.

Is there any possibility to install the plugin in the docker and refer while launching the pipeline?

0 Kudos
Maksim_S_Intel
Employee
3,628 Views

Container (openvino/ubuntu20_data_dev) includes system-wide GStreamer installation in addition to DLStreamer in OpenVINO, but system instance is "hidden" by the environment variables. You can try to add GST plugins from system to DLStreamer plugin search path, but there is no guarantee it will work:

$ export GST_PLUGIN_PATH=$GST_PLUGIN_PATH:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
$ gst-launch-1.0 \
> videotestsrc num-buffers=1000 \
> ! video/x-raw,format=BGR,width=1920,height=1080 \
> ! videoconvert \
> ! x264enc \
> ! h264parse \
> ! mp4mux \
> ! filesink sync=false location=test.mp4

 

Wan_Intel
Moderator
3,572 Views

Hi Maksim_S_Intel,


Thanks for providing your suggestions.


Hi NikhilParmar,


This thread will no longer be monitored since we have provided a solution. 

If you need any additional information from Intel, please submit a new question.


Regards,

Wan


0 Kudos
Reply