Now I can record the video to a <font class="Apple-style-span" color="#FF0000">AVI</font> file with <font class="Apple-style-span" color="#FF0000">mpeg4</font> encoding by :<br><font class="Apple-style-span" color="#000099">gst-launch v4l2src ! &#39;video/x-raw-yuv,width=320,height=240,<br>
framerate=30/1&#39; ! ffmpegcolorspace ! </font><font class="Apple-style-span" color="#FF0000">ffenc_mpeg4</font><font class="Apple-style-span" color="#000099"> ! </font><font class="Apple-style-span" color="#FF0000">avimux</font><font class="Apple-style-span" color="#000099"> ! filesink<br>
location=record.avi</font><br><br><font class="Apple-style-span" color="#FF0000">But I got two issues:</font><br>1: I want record as a <font class="Apple-style-span" color="#FF0000">MP4</font> file, I do it like this:<br>
<font class="Apple-style-span" color="#000099">gst-launch v4l2src ! &#39;video/x-raw-yuv,width=320,height=240,<br>framerate=30/1&#39; ! ffmpegcolorspace ! ffenc_mpeg4 ! </font><font class="Apple-style-span" color="#FF0000">mp4mux</font><font class="Apple-style-span" color="#000099"> ! filesink<br>
location=record.avi</font><br>I can record the video , but when I playback it by mplayer, I got a error:<br><font class="Apple-style-span" color="#FF0000">Playing ./record.mp4.<br>libavformat file format detected.<br>[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8741640]moov atom not found<br>
LAVF_header: av_open_input_stream() failed<br>ISO: File Type Major Brand: ISO/IEC 14496-1 (MPEG-4 system) v2</font><br><br>2: I want encode the video to <font class="Apple-style-span" color="#FF0000">H264</font>, so I do like this:<br>
<font class="Apple-style-span" color="#000099">gst-launch v4l2src ! &#39;video/x-raw-yuv,width=320,height=240, framerate=30/1&#39; ! ffmpegcolorspace ! </font><font class="Apple-style-span" color="#FF0000">x264enc</font><font class="Apple-style-span" color="#000099"> ! avimux ! filesink location=record.avi</font><br>
But when I run the pipeline I just get the error info like this:<br><font class="Apple-style-span" color="#FF0000">Setting pipeline to PAUSED ...<br>Pipeline is live and does not need PREROLL ...<br>Setting pipeline to PLAYING ...<br>
New clock: GstSystemClock<br>ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.<br>Additional debug info:<br>gstbasesrc.c(2550): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:<br>
streaming task paused, reason not-negotiated (-4)<br>Execution ended after 1727716724 ns.<br>Setting pipeline to PAUSED ...<br>Setting pipeline to READY ...<br>Setting pipeline to NULL ...<br>Freeing pipeline ...</font><br>
<br><div>Some one can help me fix the issues? Tks :)<br><br><br>On 12/22/10, Timothy Braun &lt;<a href="mailto:braunsquared@gmail.com">braunsquared@gmail.com</a>&gt; wrote:<br>&gt; H264 is encoded with x264enc element.<br>
&gt;<br>&gt; Sent from my iPhone<br>&gt;<br>&gt; On Dec 22, 2010, at 3:10 AM, wl2776 &lt;<a href="mailto:wl2776@gmail.com">wl2776@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; michael young wrote:<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt; And now , I want to record the video to a MP4 file with the h264 encoding<br>&gt;&gt;&gt; format  ,  How can I do ?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; On Wed, Dec 22, 2010 at 2:26 PM, michael &lt;<a href="mailto:mcygogo@gmail.com">mcygogo@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; tks, this is work:   gst-launch v4l2src device=/dev/video0 !<br>&gt;&gt;&gt;&gt; &#39;video/x-raw-yuv,width=640,height=480,framerate=30/1&#39; ! xvimagesink<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>
&gt;&gt;<br>&gt;&gt; Looks like you can&#39;t, because h264 encoder is unavailable.<br>&gt;&gt; gst-inspect | grep h264<br>&gt;&gt; doesn&#39;t show it.<br>&gt;&gt; However, general idea is to encode, then mux, and then save to a file.<br>
&gt;&gt; gst-launch v4l2src device=/dev/video0 !<br>&gt;&gt; &#39;video/x-raw-yuv,width=640,height=480,framerate=30/1&#39; !  ffenc_mpeg4 !<br>&gt;&gt; mp4mux !filesink location=/home/user/file.<br>&gt;&gt;<br>&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>&gt;&gt; <a href="http://gstreamer-devel.966125.n4.nabble.com/how-to-create-a-pipeline-to-record-video-from-camera-tp3134399p3160261.html">http://gstreamer-devel.966125.n4.nabble.com/how-to-create-a-pipeline-to-record-video-from-camera-tp3134399p3160261.html</a><br>
&gt;&gt; Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>&gt;&gt;<br>&gt;&gt; ------------------------------------------------------------------------------<br>&gt;&gt; Forrester recently released a report on the Return on Investment (ROI) of<br>
&gt;&gt; Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even<br>&gt;&gt; within 7 months.  Over 3 million businesses have gone Google with Google<br>&gt;&gt; Apps:<br>&gt;&gt; an online email calendar, and document program that&#39;s accessible from your<br>
&gt;&gt;<br>&gt;&gt; browser. Read the Forrester report: <a href="http://p.sf.net/sfu/googleapps-sfnew">http://p.sf.net/sfu/googleapps-sfnew</a><br>&gt;&gt; _______________________________________________<br>&gt;&gt; gstreamer-devel mailing list<br>
&gt;&gt; <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>&gt;&gt; <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
&gt;<br>&gt; ------------------------------------------------------------------------------<br>&gt; Forrester recently released a report on the Return on Investment (ROI) of<br>&gt; Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even<br>
&gt; within 7 months.  Over 3 million businesses have gone Google with Google<br>&gt; Apps:<br>&gt; an online email calendar, and document program that&#39;s accessible from your<br>&gt; browser. Read the Forrester report: <a href="http://p.sf.net/sfu/googleapps-sfnew">http://p.sf.net/sfu/googleapps-sfnew</a><br>
&gt; _______________________________________________<br>&gt; gstreamer-devel mailing list<br>&gt; <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>&gt; <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
&gt;<br></div>