<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Well, one step further. I'm not sure how well this is supposed to work, but I'm getting consistent results. </div><div><br></div><div>I've added config-interval to the h264parse which on a failed run gave me the codec_data buffer. I picked up this codec_data buffer and inserted this into the caps before the mp4mux before the filesink.</div><div>The matroskamux allows it, but produces an incorrect file. The mp4mux now produces a playable file with only some incorrect frames at the start, until the next keyframe.</div><div><br></div><div><br></div><div>./gst-launch-0.10 -e -vvv udpsrc multicast-group=239.255.12.12 port=5004 auto-multicast=true caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96" typefind=true ! rtph264depay ! tee name=my_sink ! queue ! "video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal" ! ffdec_h264 ! videorate ! ffmpegcolorspace ! autovideosink sync=false my_sink. ! queue ! h264parse config-interval=50 ! "video/x-h264,width=(int)1280,height=(int)720,codec_data=(buffer)01428033ffe1000967428033e900a00b7201000468ce3c80" ! mp4mux ! filesink location=/Users/gt/movie.mp4</div><div><br></div><div><br></div><div>When I code this into a C application however, h264parse doesn't want to be linked to mp4mux. The (buffer) type is a special type that</div><div>needs some special care. Here's what I'm doing:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #703daa">GstBuffer</span> *codec_data;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #703daa">GValue</span> value = { <span style="color: #272ad8">0</span> };</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #3d1d81">g_value_init</span> (&value, <span style="color: #78492a">GST_TYPE_BUFFER</span>);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27); "><span style="color: #000000"> </span><span style="color: #3d1d81">gst_value_deserialize</span><span style="color: #000000"> (&value, </span>"01428033ffe1000967428033e900a00b7201000468ce3c80"<span style="color: #000000">);</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> codec_data = <span style="color: #78492a">gst_value_get_buffer</span> (&value);</div><p style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px; "> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(61, 29, 129); "><span style="color: #000000"> incaps = </span>gst_caps_new_simple<span style="color: #000000">(</span><span style="color: #d12f1b">"video/x-h264"</span><span style="color: #000000">,</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #d12f1b">"width"</span>, <span style="color: #78492a">G_TYPE_INT</span>, <span style="color: #d12f1b">"1280"</span>,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #d12f1b">"height"</span>, <span style="color: #78492a">G_TYPE_INT</span>, <span style="color: #d12f1b">"720"</span>,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #d12f1b">"codec_data"</span>, <span style="color: #78492a">GST_TYPE_BUFFER</span>, codec_data,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #bb2ca2">NULL</span>) ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> link_ok = <span style="color: #3d1d81">gst_element_link_filtered</span>(h264parse, mp4mux, incaps);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #3d1d81">gst_caps_unref</span>(incaps) ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #3d1d81">g_value_unset</span> (&value);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #bb2ca2">if</span> (!link_ok) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(209, 47, 27); "><span style="color: #000000"> </span><span style="color: #3d1d81">g_print</span><span style="color: #000000"> (</span>"Failed to link h264parse to mp4mux!\n"<span style="color: #000000">);</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> <span style="color: #bb2ca2">return</span>;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "> }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; ">G></div><div><br></div><div><div>On Jan 17, 2013, at 12:49 PM, Gerard Toonstra <<a href="mailto:gtoonstra@gmail.com">gtoonstra@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi all,<br><br>I'm attempting to record a UDPSRC stream from an IP camera to disk without re-encoding the stream. This is on a PC that has relatively limited CPU capacity left, as it's also <br>doing other complex things with the video. So preserving CPU utilization is what I'm trying to do.<br>
<br>On the internet, I found one topic where someone else was looking for the same thing, but this didn't help me much in the end.<br><br><a href="http://lists.freedesktop.org/archives/gstreamer-devel/2012-May/035999.html">http://lists.freedesktop.org/archives/gstreamer-devel/2012-May/035999.html</a><br>
<br>and: <br><br><a href="http://lists.freedesktop.org/archives/gstreamer-devel/2010-June/027112.html">http://lists.freedesktop.org/archives/gstreamer-devel/2010-June/027112.html</a><br><br><br>when I use the "rtph264depay ! h264parse ! matroskamux ! filesink" pipeline, it fails on caps negotiation. This is because matroskamux doesn't have access to the encoding parameters. I had<br>
expected h264parse to produce those.<br><br>When I start a desktop capture and copy the sprop-params across, the above pipeline works flawlessly. I don't have those details from the IP camera, however, I can only specify width/height.<br>
I can get matroskamux to work if I also specify framerate in "video/x-h264,width=640,height=360,framerate=25/1". It seems to write to the file, but it is not playable. ffplay and mplayer complain<br>about missing encoding parameters (surprise) or "no frame!" errors. This is I think due to missing "codec_data", as specified here:<br>
<br><a href="http://gstreamer-devel.966125.n4.nabble.com/Setting-codec-data-in-h264-caps-for-qtmux-td4525597.html">http://gstreamer-devel.966125.n4.nabble.com/Setting-codec-data-in-h264-caps-for-qtmux-td4525597.html</a><br>
<br>Setting "config-interval" on h264parse did not help.<br><br>So, what i now use is the following:<br><br>gst-launch-0.10 udpsrc multicast-group=239.255.12.12 auto-multicast=true port=5004 ! "application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96" ! gstrtpjitterbuffer drop-on-latency=true latency=40 ! rtph264depay ! h264parse ! "video/x-h264,width=(int)640,height=(int)360" ! filesink location=movie.264 sync=false<br>
<br>This produces a movie.264 file and this is playable through mplayer. However, I'm seeing different results if I use kdenlive for editing for example, which plays 1 fps, so I'd prefer the mux to be used.<br><br>
Is there a way to:<br>- add the codec_data by adding something in the pipeline?<br>- extract the codec_data from the RTP stream and just pass that to the muxer?<br><br>Rgds,<br><br>G><br><br>
</blockquote></div><br></body></html>