gst encode mpeg4 or h264(avc) video.

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

gst encode mpeg4 or h264(avc) video.

4,832 Views
janiscoders
Contributor III

Hi, as I understand h264(AVC) format should be put into .mp4 container, but Freescales gstreamer plugin doesn't allow it. Using this command:

gst-launch -v --gst-debug=2 mfw_v4lsrc capture-width=640 capture-height=480 capture-mode=0  num-buffers=150 ! queue ! mfw_vpuencoder codec-type=2 bitrate=0 qp=30 gopsize=32000 ! queue ! mp4mux ! filesink location=codec2_muxmp4.mp4

I get error:

0:00:00.340959654  20360x8bd50 WARN               qtmux gstqtmux.c:3093:gst_qt_mux_video_sink_set_caps:<mp4mux0> no stream-format field in h264 caps
0:00:00.341116779  20360x8bd50 WARN               qtmux gstqtmux.c:3251:gst_qt_mux_video_sink_set_caps:<mp4mux0> pad video_00 refused caps video/x-h264, height=(int)480, width=(int)640, framerate=(fraction)30/1
0:00:00.368152154  20360x8bdb0 ERROR     mfw_vpuencoder mfw_gst_vpu_encoder.c:1691:mfw_gst_vpuenc_send_buffer: >>VPU_ENC: Error -4 in Pushing the Output to Source Pad
0:00:00.391161654  20360x8c0f0 WARN             basesrc gstbasesrc.c:2625:gst_base_src_loop:<mfwgstv4lsrc0> error: Internal data flow error.
0:00:00.391305404  20360x8c0f0 WARN             basesrc gstbasesrc.c:2625:gst_base_src_loop:<mfwgstv4lsrc0> error: streaming task paused, reason not-negotiated (-4)

ERROR: from element /GstPipeline:pipeline0/MFWGstV4LSrc:mfwgstv4lsrc0: Internal data flow error.



If I choose mpeg4 encoder, then it works.

gst-launch -v mfw_v4lsrc capture-width=640 capture-height=480 capture-mode=0  num-buffers=150 ! queue ! mfw_vpuencoder codec-type=0 bitrate=0 qp=30 gopsize=32000 ! queue ! mp4mux ! filesink location=codec0_muxmp4.mp4\

Why is that so?

Its important to use mp4, because I want to play these videos in browser using new HTML5 standard which allows mp4, ogg. I would like to use codec-type=2, because it gives better quality for the same size. Videos created with codec-type=0 can't be played via HTML5. I tried using qtmux too.

Can someone advise the right encoding parameters that would work out of the box or should I use avimux and then on server convert videos to the right format. Don't want to to this really because of extra converting and there is some information that h264 shouldn't be put in avi container.

Thank you.

Labels (3)
7 Replies

1,862 Views
YixingKong
Senior Contributor IV

Janis

This discussion is closed since no activity. If you still need help, please feel free to reply with an update to this discussion, or create another discussion.

Thanks,

Yixing

0 Kudos

1,862 Views
max_tsai
NXP Employee
NXP Employee

Hi,

I tried this command by MX53 SMD with L2.6.35_11.09.01(with FSL-mm libraries). It works.

--

gst-launch -v --gst-debug=2 mfw_v4lsrc capture-width=640 capture-height=480 capture-mode=0  num-buffers=150 ! queue ! mfw_vpuencoder codec-type=2 bitrate=0 qp=30 gopsize=32000 ! queue ! mp4mux ! filesink location=codec2_muxmp4.mp4

--

Can I know if your rootfs includes FSL MM libraries?

-Max

0 Kudos

1,862 Views
janiscoders
Contributor III

Yes it does. I have these files under /usr/lib/gstreamer-0.10 .

libgstalsa.so           libgsttypefindfunctions.so
libgstaudioconvert.so   libgstudp.so
libgstaudioresample.so  libgstvideoscale.so
libgstautodetect.so     libgstvolume.so
libgstavi.so            libgstvorbis.so
libgstcoreelements.so   libgstwavparse.so
libgstcoreindexers.so   libgstximagesink.so
libgstdecodebin.so      libmfw_gst_aacdec.so
libgstdecodebin2.so     libmfw_gst_aiur_demux.so

libgstffmpegcolorspace.so   libmfw_gst_audio_pp.so

libgstflac.so           libmfw_gst_deinterlace.so
libgstflv.so            libmfw_gst_h264dec.so
libgstgio.so            libmfw_gst_ipu_csc.so
libgstisomp4.so         libmfw_gst_isink.so
libgstmatroska.so       libmfw_gst_mp3dec.so
libgstmultifile.so      libmfw_gst_mp3enc.so
libgstogg.so            libmfw_gst_mpeg2dec.so
libgstpango.so          libmfw_gst_mpeg4aspdec.so
libgstplaybin.so        libmfw_gst_v4lsink.so
libgstrtp.so            libmfw_gst_v4lsrc.so
libgstsouphttpsrc.so    libmfw_gst_vorbisdec.so
libgsttcp.so            libmfw_gst_vpu_dec.so
libgsttheora.so         libmfw_gst_vpu_enc.so


Still got the same problem. I have created the rootfs using yocto recipes from Freescale · GitHub

I did it a while ago and haven't updated the recipes, but anyway looks like the newest Freescale mm packages are intended for imx6 processor, but I've got imx53.


0 Kudos

1,862 Views
LeonardoSandova
Specialist I

Have you tried the same pipeline using a ltib's rootfs? what happens if you do not specify just the codec type in the encoder element? could you try other muxers (matroskamux)? There are other containers you can use according to wikipedia http://en.wikipedia.org/wiki/Comparison_of_container_formats

1,862 Views
janiscoders
Contributor III

I don't really remember if it worked when I used ltib - don't remember if I really tried it, but I know one for sure - ltib is horrible compared to Yocto and I won't use it.

The same problem occurs when I specify only codec. I tried qtmux and mp4mux - both gave the same error.

Matroskamux works fine and I will probably end up using it. Thank you this is a helpful answer.

But in the end it doesn't solve my problem in case where I wanted to MUX into mp4 container. Maybe this is a problem, because of gstreamer and their Freescale plugin version inconsistency (probably Yocto is using newer versions compared to ltib)

1,862 Views
YixingKong
Senior Contributor IV

Janis

We have not got your response yet and will close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos

1,862 Views
imxcommunitysco
Senior Contributor II

Hi Janis

We are sorry for getting back to you so late. Are you still stuck with the issue? If you still need help, please feel free to reply with an update to this discussion. I will branch your discussion into an internal group and assign an engineer to work on it.

Regards,

Yixing

0 Kudos