I'm decoding MPEG2-PS file with GStreamer mpegdec plug-in and encoding it to H.264
by vpuenc_h264, but error message is generated.
I ran the following pipeline:
GST_DEBUG=3 gst-launch-1.0 filesrc location=./mpeg2.ps ! mpegpsdemux ! mpeg2dec ! vpuenc_h264 ! filesink location=./dump.h264
I got the following error:
Setting pipeline to PAUSED ...
====== VPUENC 4 4 4 build on Apr 23 2019 07:42:51. ======
wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Apr 23 2019 06:54:12)
vpulib: 1.1.1
firmware: 1.1.1.65535
0:00:00.064596250 12940 0x678ef0 WARN basesrc gstbasesre. c:3583: gst_base_src_start_complete: <filesrcO> pad not activated yet
Pipeline is PREROADING ...
0:00:00.067196750 12940 0x662a80 FIXME videodecoder gstvideodecoder. c:933: gst_video_decoder_drain_out: <mpeg2dec0> Sub-class should implement drain()
0:00:00.067376375 12940 0x662a80 FIXME videodecoder gstvideodecoder. c:933: gst_video_decoder_drain_out: <mpeg2dec0> Sub-class should implement drain()
Redistrbute latency...
0:00:00.090570500 12940 0x662a80 WARN vpuallocator gstvpuallocator. c:125: gst_vpu_copy_phys_mem: TODO: use relevant hardware to accelerate memory copying!
OMX H264 ! HantroHwEncOmx_encoder_create_h264 H264EncInit failed! (-3) openmax_il/source/encoder/encoder_h264.c:772
0:00:00.091269250 12940 0x662a80 ERROR vpuenc gstvpuenc. c:774:gst_vpu_enc_open_vpu:<vpuenc_h264-0> opening new VPU handle failed: failure
0.00.00.091355000 12940 0x662a80 ERROR vpuenc gstvpuenc. c.947:gst_vpu_enc_handle_frame:<vpuenc_h264-0> gst_vpu_enc_open_vpu failed.
0:00:00.091424625 12940 0x662a80 WARN mpegpsdemux gstmpegdemux. c.2944: gst_ps_demux_loop:<mpegpsdemuxO> error: Internal data stream error.
0:00:00.091455625 12940 0x662a80 WARN mpegpsdemux gstmpegdemux. c.2944: gst_ps_demux_loop:<mpegpsdemuxO> error: streaming stopped, reason error (-5)
ERROR: from element /GstPipeline:pipeline0/GstMpegPSDemux:mpegpsdemux0: Internal data stream error.
Additional debug info:
gstmpegdemux. c(2944): gst_ps_demux_loop (): /GstPipeline:pipeline0/GstMpegPSDemux:mpegpsdemux0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
MPEG2 PS file is 1920x1080 resolution and 30fps video. Without H.264 encoding, no error occurred.
Could someone advise me ?
If MPEG content needed, it is possible to upload.
refer to the Table 18. Parser/Demuxer supported audio/video of enclosed file, mpeg2 demux support avi, mpeg2 and mkv, so check if your video is correct format, did you try to other files? the same issue? and how about trying the avidemux to your file?
aiurdemux: aiur universal demuxer plugin supporting
Supports AVI, MKV, MP4, MPEG2, ASF, OGG, FLV, WebM, RMVB
I tried other content as follows.
MPG container format includes video as MPEG2 video and audio as MPEG2 Layer-I.
This occurred following error.
root@ucm-imx8m-mini:/opt/tcr# gst-launch-1.0 filesrc location=./sample2_h.mpg ! mpegpsdemux ! mpeg2dec ! vpuenc_h264 !
filesink location=./dumphoge.h264
Setting pipeline to PAUSED ...
====== VPUENC: 4.4.4 build on Apr 23 2019 07:42:51. ======
wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Apr 23 2019 06:54:12)
vpulib: 1.1.1
firmware: 1.1.1.65535
Pipeline is PREROLLING ...
Redistribute latency...
OMX H264 ! HantroHwEncOmx_encoder_create_h264 H264EncInit failed! (-3) openmax_il/source/encoder/encoder_h264.c:772
ERROR: from element /GstPipeline:pipeline0/GstMpegPSDemux:mpegpsdemux0: Internal data stream error.
Additional debug info:
../../../git/gst/mpegdemux/gstmpegdemux.c(2944): gst_ps_demux_loop (): /GstPipeline:pipeline0/GstMpegPSDemux:mpegpsdemux0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
However, if encoder plug-in changed from h264 to mpeg2video, no error occurred.
root@ucm-imx8m-mini:/opt/tcr# gst-launch-1.0 filesrc location=./sample2_h.mpg ! mpegpsdemux ! mpeg2dec ! avenc_mpeg2video ! filesink location=./dumphoge.h264
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Is this content problem ?
pls refer to the release note I sent to you, imx8mm vpu doesn't support encoding and decoding mpeg2
As I can't understand, please show pages in the release note you said.
You mean it is not possible for i.MX8M-mini to do hardware decoding and hardware encoding at same time ?
I have already uploaded the release note in the previous reply, could you find it? if yes, you can refer to the
Table 8. Supported features, find the VPU part:
i.MX 8QuadMax and 8QuadXPlus Decoder: HEVC, H.264, MPEG4, MPEG2
i.MX 8M Quad Decoder: HEVC, VP9, H.264, VP8, RV9, AVS, MJPEG, H.263
i.MX 8M Mini Decoder: HEVC, VP9, H.264, VP8
i.MX 8M Mini Encoder: H.264, VP8
i.MX 8M Plus Encoder: 1080p60 HEVC, H.264
i.MX 8M Plus Decoder : 1080p60 HEVC, H.264, VP9, VP8
only imx8qm and imx8qxp vpu decoder support mpeg2
We think 'mpeg2dec' plug-in is not vpu based but software based decoder.
The specification of mpeg2dec is as follows.
root@ucm-imx8m-mini:/usr/lib/gstreamer-1.0# gst-inspect-1.0 mpeg2dec
Factory Details:
Rank secondary (128)
Long-name mpeg1 and mpeg2 video decoder
Klass Codec/Decoder/Video
Description Uses libmpeg2 to decode MPEG video streams
Author Wim Taymans <wim.taymans@chello.be>
Plugin Details:
Name mpeg2dec
Description LibMpeg2 decoder
Filename /usr/lib/gstreamer-1.0/libgstmpeg2dec.so
Version 1.14.0
License GPL
Source module gst-plugins-ugly
Source release date 2018-03-19
Binary package GStreamer Ugly Plug-ins source release
Origin URL Unknown package origin
If mpeg2dec is vpu based, why following pipeline results in successful execution ?
gst-launch-1.0 filesrc location=./sample2_h.mpg ! mpegpsdemux ! mpeg2dec ! fakesink
sorry for my misunderstanding, I thought you want to encode and decode mpeg2 file by VPU, how about add h264parse after vpuenc_h264?
No changes occurred.
root@ucm-imx8m-mini:/opt/tcr# root@ucm-imx8m-mini:/opt/tcr# gst-launch-1.0 filesrc location=./mpeg2.ps ! mpegpsdemux ! mpeg2dec ! vpuenc_h264 ! h264parse ! filesink location=./dumpxx.h264
Setting pipeline to PAUSED ...
====== VPUENC: 4.4.4 build on Apr 23 2019 07:42:51. ======
wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Apr 23 2019 06:54:12)
vpulib: 1.1.1
firmware: 1.1.1.65535
Pipeline is PREROLLING ...
Redistribute latency...
OMX H264 ! HantroHwEncOmx_encoder_create_h264 H264EncInit failed! (-3) openmax_il/source/encoder/encoder_h264.c:772
ERROR: from element /GstPipeline:pipeline0/GstMpegPSDemux:mpegpsdemux0: Internal data stream error.
Additional debug info:
../../../git/gst/mpegdemux/gstmpegdemux.c(2944): gst_ps_demux_loop (): /GstPipeline:pipeline0/GstMpegPSDemux:mpegpsdemux0:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
We had confirmed the problem was resolved by GStreamer 1.16.1 and VPU 4.5.5.
Thank you !