Problems in H.264 encoding and decoding video using MINISASTOCSI in imx8mpevk

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems in H.264 encoding and decoding video using MINISASTOCSI in imx8mpevk

Jump to solution
4,881 Views
kenizgandhi
Contributor III

Hello,

I am able to display the video using waylandsink and autovideosink commands:

gst-launch-1.0 v4l2src device=/dev/video1 ! autovideosink  

gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=1920,height=1080 ! queue max-size-time=0 ! waylandsink enable-tile=true sync=false

I am using imx8mpevk board.

root@imx8mpevk:/# uname -r
5.10.9-1.0.0+g32513c25d8c7

But I am unable to perform H.264 encoding and decoding of video. I tried the below commands: 

root@imx8mpevk:~# gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,width=640,height=480 ! \
> v4l2h264enc extra-controls="controls,h264_entropy_mode=0,video_bitrate=245000;" ! \
> h264parse ! v4l2h264dec ! queue ! waylandsink sync=false
WARNING: erroneous pipeline: no element "v4l2h264enc"

root@imx8mpevk:/# gst-launch-1.0 videotestsrc ! video/x-raw, format=I420, width=640, height=480 ! vpuenc_h264 ! filesink location=test.mp4
Setting pipeline to PAUSED ...
====== VPUENC: 4.6.0 build on Jan 29 2021 08:22:32. ======
wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Feb 18 2021 02:40:50)
vpulib: 1.1.1
firmware: 1.1.1.43690
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:08.299120750
Setting pipeline to NULL ...
Freeing pipeline ...
root@imx8mpevk:/# gst-launch-1.0 filesrc location=test.mp4 ! qtdemux name=d d.video_0 ! queue ! h264parse ! vpudec ! queue ! waylandsink
Setting pipeline to PAUSED ...
====== VPUDEC: 4.6.0 build on Jan 29 2021 08:22:32. ======
wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Feb 18 2021 02:40:50)
vpulib: 1.1.1
firmware: 1.1.1.43690
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstQTDemux:d: This file is invalid and cannot be played.
Additional debug info:
../git/gst/isomp4/qtdemux.c(535): gst_qtdemux_pull_atom (): /GstPipeline:pipeline0/GstQTDemux:d:
atom has bogus size 9911666659956916224
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstQTDemux:d: Internal data stream error.
Additional debug info:
../git/gst/isomp4/qtdemux.c(6545): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstQTDemux:d:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPipeline:pipeline0/GstQTDemux:d: This file contains no playable streams.
Additional debug info:
../git/gst/isomp4/qtdemux.c(489): gst_qtdemux_post_no_playable_stream_error (): /GstPipeline:pipeline0/GstQTDemux:d:
no known streams found
ERROR: pipeline doesn't want to preroll.
Freeing pipeline ...

root@imx8mpevk:~# gst-launch-1.0 videotestsrc device=/dev/video1 ! video/x-raw, format=I420, width=640, height=480 ! vpuenc_h264 ! filesink location=test.mp4
WARNING: erroneous pipeline: no property "device" in element "videotestsrc0"

 

I would be obliged if you can help me solve this issue. 

If you need any further information, feel free to ask me.

Thank You.

Tags (3)
0 Kudos
Reply
1 Solution
4,874 Views
kenizgandhi
Contributor III

Hello, I got the output. In case if anyone wants, I am writing the commands below. Hope it helps.

gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 ! video/x-raw,width=1920,height=1080 ! vpuenc_h264 ! avimux ! filesink location=test1_h264.avi
gst-launch-1.0 filesrc location=test1_h264.avi ! queue ! h264parse ! vpudec ! imxvideoconvert_g2d ! queue ! autovideosink

 

// dont use qtdemux if you are decoding h264 stream. use qtdemux when you are decoding mov or mp4 files.

View solution in original post

Tags (1)
0 Kudos
Reply
1 Reply
4,875 Views
kenizgandhi
Contributor III

Hello, I got the output. In case if anyone wants, I am writing the commands below. Hope it helps.

gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 ! video/x-raw,width=1920,height=1080 ! vpuenc_h264 ! avimux ! filesink location=test1_h264.avi
gst-launch-1.0 filesrc location=test1_h264.avi ! queue ! h264parse ! vpudec ! imxvideoconvert_g2d ! queue ! autovideosink

 

// dont use qtdemux if you are decoding h264 stream. use qtdemux when you are decoding mov or mp4 files.

Tags (1)
0 Kudos
Reply