elwebmaster
Posts: 4
Joined: Fri Oct 19, 2012 12:07 am

MPEG2 to H264 with GStreamer

Sun Mar 16, 2014 3:12 am

I am trying to transcode mpeg2 stream to h264. My input stream is as follows (1 video + 2 audio):

Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt470bg), 720x576 [SAR 16:15 DAR 4:3], max. 4000 kb/s,
25 fps, 25 tbr, 90k tbn, 50 tbc
Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s (clean effects)
Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz, stereo, s16p, 128 kb/s (clean effects)

I want my output stream to be H264 video and have audio. It doesn't matter if the audio is just copied from the input, if I have both channels or just one, or if the audio is transcoded to aac/mp3. I just need any audio. I can't figure out how to do it with GStreamer, this is what I have:

gst-launch-1.0 souphttpsrc location="http://SOME_IP" ! tsdemux ! queue max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! matroskamux streamable=true ! tcpserversink host=MY_IP port=5000

It does the video part, but I can't figure out a way to add audio to it. Any help will be valuable.

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: MPEG2 to H264 with GStreamer

Sun Mar 16, 2014 4:45 pm

You’ll have to name the tsdemux and name the matroskamux. Then start two chains from the demuxer name, one that feeds the omxh264enc and then into the named matroskamux and another one that starts with the named tsdemux and then without re-encoding into the named matroskamux. That is, you need two chains between the demuxer and the muxer: one for video and one for audio.

I can’t test right now, but it should look roughly like this:

Code: Select all

gst-launch-1.0 \
souphttpsrc location="http://SOME_IP" ! tsdemux name=demuxer \
    matroskamux name=muxer streamable=true ! tcpserversink host=MY_IP port=5000 \
    demuxer ! queue ! mpegvideoparse \
        ! mpeg2dec ! videoconvert \
        ! omxh264enc ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! muxer \
    demuxer ! <...> ! mpegaudioparse ! <...> ! muxer

elwebmaster
Posts: 4
Joined: Fri Oct 19, 2012 12:07 am

Re: MPEG2 to H264 with GStreamer

Sun Mar 16, 2014 5:05 pm

Thank you! I was able to do it like this:

gst-launch-1.0 -v souphttpsrc location="http://SOME_IP" is-live=true ! tsdemux name=demux ! queue ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc control-rate=1 target-bitrate=1250000 ! video/x-h264,width=720,height=576,framerate=25/1,stream-format=byte-stream,profile=high ! h264parse ! matroskamux streamable=true name=mux ! tcpserversink host=MY_IP port=5000 demux. ! queue ! mpegaudioparse ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! mux.

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Tue Apr 01, 2014 11:54 am

thx for your share.
this pipe is working fpr me too:

Code: Select all

gst-launch-1.0 -v --gst-debug=4 souphttpsrc location="http://xxx.xxx.xxx.xxx:8001/xxxxx" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc control-rate=1 target-bitrate=1250000 ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! matroskamux streamable=true name=mux ! filesink location=test.mkv demux. ! queue ! mpegaudioparse ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! mux.
how can i get this run as rtmpslink?
any body can help me?

thx

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Tue Apr 01, 2014 12:06 pm

tha for ur share.
this pipe is also working for me:

Code: Select all

gst-launch-1.0 -v --gst-debug=4 souphttpsrc location="http://192.168.x.xx8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc control-rate=1 target-bitrate=1250000 ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! matroskamux streamable=true name=mux ! filesink location=test.mkv demux. ! queue ! mpegaudioparse ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! mux.
but ho can i get this run as rtmpsink? to conect to my wowza server?
can anybody help he? thx

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: MPEG2 to H264 with GStreamer

Tue Apr 01, 2014 7:18 pm

Replace this part

Code: Select all

matroskamux streamable=true name=mux ! filesink location=test.mkv
with

Code: Select all

flxmux name=mux ! rtmpsink location='rtmp://<server>/<path> live=1'

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 10:56 am

thx for ur quick replay.

i have try with this:

Code: Select all

gst-launch-1.0 -v --gst-debug=2 souphttpsrc location="http://192.168.x.y:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc control-rate=1 target-bitrate=1250000 ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! flvmux name=mux ! rtmpsink location='rtmp://wowza/live/test2 live=1' demux. ! queue ! mpegaudioparse ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! mux.
gst-lauch start but the it closed with this error:
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:sink: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false, parsed=(boolean)true, width=(int)544, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)24/17, codec_data=(buffer)000001b322024023249f238110111113121314141414161516151617171817181719191a191a18191a1a1b1b1c1b1b1a1c1d1d1e1d1d1c1f1f201f201e21222122212423242326272629282b000001b5148200010000, profile=(string)main, level=(string)main, interlace-mode=(string)mixed
Verzögerung neu verteilen …
0:00:04.933256487 14532 0x11f6ac0 WARN bin gstbin.c:2474:gst_bin_do_latency_func:<pipeline0> failed to query latency
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:src: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:src: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
0:00:06.892721592 14532 0x13d0e30 ERROR omxvideoenc gstomxvideoenc.c:724:gst_omx_video_enc_handle_output_frame:<omxh264enc-omxh264enc0> No corresponding frame found
0:00:06.912725143 14532 0x13d0e30 ERROR omxvideoenc gstomxvideoenc.c:724:gst_omx_video_enc_handle_output_frame:<omxh264enc-omxh264enc0> No corresponding frame found
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, framerate=(fraction)25/1, parsed=(boolean)true, codec_data=(buffer)01640028ffe1000e27640028ac2b4044093403c489a801000528ee025cb0
/GstPipeline:pipeline0/GstFlvMux:mux.GstPad:video: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, framerate=(fraction)25/1, parsed=(boolean)true, codec_data=(buffer)01640028ffe1000e27640028ac2b4044093403c489a801000528ee025cb0
/GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:src: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:src: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstVoAacEnc:voaacenc0.GstPad:sink: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstAudioResample:audioresample0.GstPad:sink: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstAudioRate:audiorate0.GstPad:sink: caps = audio/x-raw, layout=(string)interleaved, rate=(int)48000, format=(string)S16LE, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstAudioConvert:audioconvert0.GstPad:sink: caps = audio/x-raw, format=(string)S32LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstVoAacEnc:voaacenc0.GstPad:src: caps = audio/mpeg, mpegversion=(int)4, channels=(int)2, rate=(int)48000, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1190
0:00:07.618363336 14532 0x11b5350 WARN GST_PADS gstpad.c:3577:gst_pad_peer_query:<voaacenc0:src> could not send sticky events
0:00:07.660182399 14532 0x11b5630 WARN basesrc gstbasesrc.c:2812:gst_base_src_loop:<souphttpsrc0> error: Interner Fehler im Datenfluss.
0:00:07.682640896 14532 0x11b5630 WARN basesrc gstbasesrc.c:2812:gst_base_src_loop:<souphttpsrc0> error: streaming task paused, reason not-negotiated (-4)
FEHLER: Von Element /GstPipeline:pipeline0/GstSoupHTTPSrc:souphttpsrc0: Interner Fehler im Datenfluss.
Zusätzliche Fehlerdiagnoseinformation:
gstbasesrc.c(2812): gst_base_src_loop (): /GstPipeline:pipeline0/GstSoupHTTPSrc:souphttpsrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 5317032889 ns.
Leitung wird auf PAUSIERT gesetzt ...
Leitung wird auf BEREIT gesetzt ...
Leitung wird auf NULL gesetzt ...
Leitung wird geleert ...
root@raspberrypi:~#
if i try without sound then its working:

Code: Select all

gst-launch-1.0 -v --gst-debug=2 souphttpsrc location="http://192.168.x.y:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc control-rate=1 target-bitrate=1250000 ! video/x-h264,stream-format=byte-stream,profile=high ! h264parse ! flvmux name=mux ! rtmpsink location='rtmp://wowza/live/test2 live=1'
u have any idea?

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 12:54 pm

hey, with this config i get video and audio but my cpu load is 95-100%:

u have any idea how to optimize the cpu load?

Code: Select all

gst-launch-1.0 -v --gst-debug=2 souphttpsrc location="http://192.168.x.y:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc target-bitrate=1350000 control-rate=variable ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! flvmux name=mux ! rtmpsink location="rtmp://wowzaurl/live/test2 live=1" demux. ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegaudioparse ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! mux.

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 2:56 pm

Delete all this:

Code: Select all

 ! queue ! mad ! audioconvert ! queue ! voaacenc bitrate=128000 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw
It shouldn't be necessary to decode and re-encode the audio from MP3 to AAC on the CPU. FLV supports MP3 and I suppose your target server supports it too?

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 3:04 pm

i get this error:
0:00:00.832449376 2247 0xf98320 ERROR GST_PIPELINE ./grammar.y:622:gst_parse_perform_link: mpegaudioparse0 konnte nicht mit aacparse0 verknüpft werde
with this config

Code: Select all

gst-launch-1.0 -v --gst-debug=2 souphttpsrc location="http://192.168.x.y:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc target-bitrate=1350000 control-rate=variable ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! flvmux name=mux ! rtmpsink location="rtmp://wowzaurl/live/test2 live=1" demux. ! queue ! mpegaudioparse ! aacparse ! mux.

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 3:09 pm

Delete the aacparse too. I had updated my post already.

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 3:15 pm

it also not working

Code: Select all

gst-launch-1.0 -v --gst-debug=4 souphttpsrc location="http://192.168.y.x:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc target-bitrate=1350000 control-rate=variable ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! flvmux name=mux ! rtmpsink location="rtmp://wowzaurl/live/test2 live=1" demux. ! queue ! mpegaudioparse ! mux.
0:00:02.195860873 2428 0x2bfe30 WARN mpegtsbase mpegtsbase.c:526:mpegts_base_program_add_stream: Stream already present !
0:00:02.199063801 2428 0x2bfe30 WARN tsdemux tsdemux.c:1300:gst_ts_demux_queue_data: Didn't get the first packet of this PES
0:00:02.202446725 2428 0x2bfe30 WARN tsdemux tsdemux.c:1300:gst_ts_demux_queue_data: Didn't get the first packet of this PES
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false
/GstPipeline:pipeline0/GstMpegvParse:mpegvparse0.GstPad:sink: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false
/GstPipeline:pipeline0/GstMpegvParse:mpegvparse0.GstPad:src: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false, parsed=(boolean)true, width=(int)544, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)24/17, codec_data=(buffer)000001b322024023249f238110111113121314141414161516151617171817181719191a191a18191a1a1b1b1c1b1b1a1c1d1d1e1d1d1c1f1f201f201e21222122212423242326272629282b000001b5148200010000, profile=(string)main, level=(string)main, interlace-mode=(string)mixed
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:sink: caps = video/mpeg, mpegversion=(int)2, systemstream=(boolean)false, parsed=(boolean)true, width=(int)544, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)24/17, codec_data=(buffer)000001b322024023249f238110111113121314141414161516151617171817181719191a191a18191a1a1b1b1c1b1b1a1c1d1d1e1d1d1c1f1f201f201e21222122212423242326272629282b000001b5148200010000, profile=(string)main, level=(string)main, interlace-mode=(string)mixed
Verzögerung neu verteilen …
0:00:02.256540515 2428 0x2c0f00 WARN bin gstbin.c:2474:gst_bin_do_latency_func:<pipeline0> failed to query latency
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstMpeg2dec:mpeg2dec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)544, height=(int)576, pixel-aspect-ratio=(fraction)24/17, interlace-mode=(string)mixed, chroma-site=(string)mpeg2, colorimetry=(string)bt601, framerate=(fraction)25/1
0:00:03.083168021 2428 0x2bfe30 WARN basesrc gstbasesrc.c:2812:gst_base_src_loop:<souphttpsrc0> error: Interner Fehler im Datenfluss.
0:00:03.092214819 2428 0x2bfe30 WARN basesrc gstbasesrc.c:2812:gst_base_src_loop:<souphttpsrc0> error: streaming task paused, reason not-negotiated (-4)
FEHLER: Von Element /GstPipeline:pipeline0/GstSoupHTTPSrc:souphttpsrc0: Interner Fehler im Datenfluss.
Zusätzliche Fehlerdiagnoseinformation:
gstbasesrc.c(2812): gst_base_src_loop (): /GstPipeline:pipeline0/GstSoupHTTPSrc:souphttpsrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 2498684098 ns.
Leitung wird auf PAUSIERT gesetzt ...
Leitung wird auf BEREIT gesetzt ...
Leitung wird auf NULL gesetzt ...
Leitung wird geleert ...
root@raspberrypi:~#

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 3:20 pm

it looks like the audio is not MP3
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = audio/mpeg, mpegversion=(int)1
looks like mpeg1

did it work with FLV too?
my wowza support mp3

towolf
Posts: 421
Joined: Fri Jan 18, 2013 2:11 pm

Re: MPEG2 to H264 with GStreamer

Thu Apr 03, 2014 10:34 pm

MP3 is short for MPEG 1 layer 3.

Dunno why it doesn’t work. Try a shorter pipeline and systematically eliminate the issue.

For instance, I get this info ,when I try it with a proper mp3 file:

Code: Select all

gst-launch-1.0 -v filesrc location=viel.mp3 ! mpegaudioparse ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstMpegAudioParse:mpegaudioparse0.GstPad:src: caps = audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)1, layer=(int)3, rate=(int)44100, channels=(int)2, parsed=(boolean)true

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Fri Apr 04, 2014 7:35 am

ok i will check later

with video only i also have a high cpu load. is that possible to decode via pi hardware? becase currenly am doing it with mpeg2dec
this is my config for video only

Code: Select all

gst-launch-1.0 -v --gst-debug=2 souphttpsrc location="http://dm800:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue max-size-buffers=1200 max-size-buffers=0 max-size-time=0 ! mpegvideoparse ! mpeg2dec ! videoconvert ! omxh264enc target-bitrate=1350000 control-rate=variable ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! flvmux name=mux ! rtmpsink location="rtmp://wowzaurl/live/test2 live=1"
i have try this config to do via hardware but i get error:

Code: Select all

gst-launch-1.0 -v --gst-debug=2 souphttpsrc location="http://dm800:8001/1:0:1:39A:17D4:9E:5A0000:0:0:0:" is-live=true ! tsdemux name=demux ! queue ! mpegvideoparse ! omxmpeg2videodec ! queue ! omxh264enc ! "video/x-h264,stream-format=byte-stream,profile=high" ! h264parse ! flvmux name=mux ! rtmpsink location="rtmp://wowzaurl/live/test2 live=1"
0:00:02.620003879 12784 0x48c380 ERROR omx gstomx.c:1456:gst_omx_port_set_flushing:<omxmpeg2videodec-omxmpeg2videodec0> Component video_decode is in error state: Unsupported setting (0x80001019)
any idea?

blackserver
Posts: 9
Joined: Tue Apr 01, 2014 11:47 am

Re: MPEG2 to H264 with GStreamer

Fri Apr 04, 2014 10:56 am

its working now. i have add the MPEG-2 license key (http://www.raspberrypi.com/mpeg-2-license-key/)

but i still get one error, does anybody know what this error means:

Code: Select all

0:00:20.929502456  3112   0xaa2920 ERROR            omxvideoenc gstomxvideoenc.c:724:gst_omx_video_enc_handle_output_frame:<omxh264enc-omxh264enc0> No corresponding frame found
0:00:37.755783294  3112   0xaa2920 ERROR            omxvideoenc gstomxvideoenc.c:724:gst_omx_video_enc_handle_output_frame:<omxh264enc-omxh264enc0> No corresponding frame found
0:00:55.879266394  3112   0xaa2920 ERROR            omxvideoenc gstomxvideoenc.c:724:gst_omx_video_enc_handle_output_frame:<omxh264enc-omxh264enc0> No corresponding frame found
0:01:13.608010373  3112   0xaa2920 ERROR            omxvideoenc gstomxvideoenc.c:724:gst_omx_video_enc_handle_output_frame:<omxh264enc-omxh264enc0> No corresponding frame found

Return to “Camera board”