Hi Santakivi:<br> I have tried your method, <div>1: I run it like this:</div><div><font class="Apple-style-span" color="#000099">gst-launch </font><font class="Apple-style-span" color="#FF0000">videotestsrc num-buffers=200</font><font class="Apple-style-span" color="#000099"> ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! ffmpegcolorspace ! ffenc_mpeg4 ! mp4mux ! filesink location=record.mp4</font></div>
<div>then, I can got a right MP4 file, and I can palyback it. But I record the video from my capture like this:<br><font class="Apple-style-span" color="#000099">gst-launch </font><font class="Apple-style-span" color="#FF0000">v4l2src num-buffers=200</font><font class="Apple-style-span" color="#000099"> ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! ffmpegcolorspace ! ffenc_mpeg4 ! mp4mux ! filesink location=record.mp4</font><br>
I also got a file , But it cannot playback , I just get info like this:<br><div><font class="Apple-style-span" color="#FF0000">Playing record.mp4.</font></div><div><font class="Apple-style-span" color="#FF0000">libavformat file format detected.</font></div>
<div><font class="Apple-style-span" color="#990000">[mpeg4 @ 0x9958c10]Error, header damaged or not MPEG4 header (f_code=0)</font></div><div><font class="Apple-style-span" color="#990000">[mpeg4 @ 0x9958c10]header damaged</font></div>
<div><font class="Apple-style-span" color="#FF0000">[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9957640]Could not find codec parameters (Video: mpeg4, yuv420p)</font></div><div><font class="Apple-style-span" color="#FF0000">LAVF_header: av_find_stream_info() failed</font></div>
<div><font class="Apple-style-span" color="#FF0000">ISO: File Type Major Brand: ISO/IEC 14496-1 (MPEG-4 system) v2</font></div><div><font class="Apple-style-span" color="#FF0000">Quicktime/MOV file format detected.</font></div>
<div><font class="Apple-style-span" color="#FF0000">[mov] Video stream found, -vid 0</font></div><div><font class="Apple-style-span" color="#FF0000">VIDEO: [mp4v] 640x480 24bpp inf fps 0.0 kbps ( 0.0 kbyte/s)</font></div>
<div><font class="Apple-style-span" color="#FF0000">open: No such file or directory</font></div><div><font class="Apple-style-span" color="#FF0000">[MGA] Couldn't open: /dev/mga_vid</font></div><div><font class="Apple-style-span" color="#FF0000">open: No such file or directory</font></div>
<div><font class="Apple-style-span" color="#FF0000">[MGA] Couldn't open: /dev/mga_vid</font></div><div><font class="Apple-style-span" color="#FF0000">[VO_TDFXFB] Can't open /dev/fb0: Permission denied.</font></div>
<div><font class="Apple-style-span" color="#FF0000">[VO_3DFX] Unable to open /dev/3dfx.</font></div><div><font class="Apple-style-span" color="#FF0000">==========================================================================</font></div>
<div><font class="Apple-style-span" color="#FF0000">Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family</font></div><div><font class="Apple-style-span" color="#FF0000">Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)</font></div>
<div><font class="Apple-style-span" color="#FF0000">==========================================================================</font></div><div><font class="Apple-style-span" color="#FF0000">Audio: no sound</font></div><div>
<font class="Apple-style-span" color="#FF0000">Starting playback...</font></div><div><font class="Apple-style-span" color="#FF0000">VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)</font></div><div>
<font class="Apple-style-span" color="#FF0000">VDec: using Planar YV12 as output csp (no 0)</font></div><div><font class="Apple-style-span" color="#FF0000">Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.</font></div>
<div><font class="Apple-style-span" color="#FF0000">VO: [xv] 640x480 => 640x480 Planar YV12 </font></div><div><font class="Apple-style-span" color="#FF0000">V: 0.0 200/200 ??% ??% ??,?% 0 0 </font></div><div><font class="Apple-style-span" color="#FF0000"><br>
</font></div><div><font class="Apple-style-span" color="#FF0000">Exiting... (End of file)</font></div></div><div><br></div><div>2: I run this:<br><div><font class="Apple-style-span" color="#3333FF">gst-launch v4l2src ! 'video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,framerate=30/1' ! ffmpegcolorspace ! x264enc ! avimux ! filesink location=record.avi</font></div>
<div>But I just got error like this:</div><div><font class="Apple-style-span" color="#FF0000">Setting pipeline to PAUSED ...</font></div><div><font class="Apple-style-span" color="#FF0000">ERROR: Pipeline doesn't want to pause.</font></div>
<div><font class="Apple-style-span" color="#FF0000">ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not negotiate format</font></div><div><font class="Apple-style-span" color="#FF0000">Additional debug info:</font></div>
<div><font class="Apple-style-span" color="#FF0000">gstbasesrc.c(2755): gst_base_src_start (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:</font></div><div><font class="Apple-style-span" color="#FF0000">Check your filtered caps, if any</font></div>
<div><font class="Apple-style-span" color="#FF0000">Setting pipeline to NULL ...</font></div><div><font class="Apple-style-span" color="#FF0000">Freeing pipeline ...</font></div></div><div>I don't know the <font class="Apple-style-span" color="#FF0000">fourcc</font> means what, then I modified it to this:<br>
<span class="Apple-style-span" style="color: rgb(51, 51, 255); ">gst-launch v4l2src ! 'video/x-raw-yuv,format=I420,width=320,height=240,framerate=30/1' ! ffmpegcolorspace ! x264enc ! avimux ! filesink location=record.avi</span></div>
<div>But I just got warning like this:<br><font class="Apple-style-span" color="#FF0000">WARNING: erroneous pipeline: could not link v4l2src0 to ffmpegcsp0</font></div><div>and <font class="Apple-style-span" color="#FF0000">cannot</font> record the video. And I replaced the format I420 to others just like YVU9 YV12 and</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div> so on what I found by: <font class="Apple-style-span" color="#000099">gst-inspect v4l2src, </font>but there is <font class="Apple-style-span" color="#FF0000">no </font>one can work :(</div>
<div><br></div><div><font class="Apple-style-span" color="#000099"></font><br><div class="gmail_quote">On Wed, Dec 22, 2010 at 8:31 PM, Santakivi Topi <span dir="ltr"><<a href="mailto:Topi.Santakivi@digia.com">Topi.Santakivi@digia.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 12/22/2010 12:18 PM, michael wrote:<br>
> Now I can record the video to a AVI file with mpeg4 encoding by :<br>
> gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240,<br>
> framerate=30/1' ! ffmpegcolorspace ! ffenc_mpeg4! avimux! filesink<br>
> location=record.avi<br>
><br>
> But I got two issues:<br>
> 1: I want record as a MP4 file, I do it like this:<br>
> gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240,<br>
> framerate=30/1' ! ffmpegcolorspace ! ffenc_mpeg4 ! mp4mux! filesink<br>
> location=record.avi<br>
> I can record the video , but when I playback it by mplayer, I got a error:<br>
> 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<br>
<br>
</div>When recording, with the above gst-launch line, do you stop<br>
the pipeline with Ctrl+C..?<br>
<br>
It could be that the file container doesn't get fully written<br>
in case of such an interrupt and that's why the clip doesn't play.<br>
<br>
For example, if you use this pipeline and<br>
stop it with Ctrl+C, the clip doesn't play:<br>
<br>
gst-launch-0.10 videotestsrc !<br>
<div class="im">'video/x-raw-yuv,width=320,height=240,framerate=30/1' ! ffmpegcolorspace<br>
</div>! ffenc_mpeg4 ! mp4mux ! filesink location=test.mp4<br>
<br>
But this pipeline produces a valid video file:<br>
<br>
gst-launch-0.10 videotestsrc num-buffers=200 !<br>
<div class="im">'video/x-raw-yuv,width=320,height=240,framerate=30/1' ! ffmpegcolorspace<br>
</div>! ffenc_mpeg4 ! mp4mux ! filesink location=test.mp4<br>
<div class="im"><br>
><br>
> 2: I want encode the video to H264, so I do like this:<br>
> gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240,<br>
> framerate=30/1' ! ffmpegcolorspace ! x264enc! avimux ! filesink<br>
> location=record.avi<br>
<br>
</div>How about adding the format to the caps, e.g .<br>
v4l2src ! 'video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,<br>
framerate=30/1' ! fmpegcolorspace ! x264enc! avimux ! filesink<br>
location=record.avi ?<br>
<br>
BR,<br>
Topi<br>
<div class="im"><br>
> But when I run the pipeline I just get the error info like this:<br>
> 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<br>
> data flow error.<br>
> Additional debug info:<br>
> gstbasesrc.c(2550): gst_base_src_loop ():<br>
> /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 ...<br>
><br>
> Some one can help me fix the issues? Tks :)<br>
><br>
><br>
> On 12/22/10, Timothy Braun <<a href="mailto:braunsquared@gmail.com">braunsquared@gmail.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:braunsquared@gmail.com">braunsquared@gmail.com</a>>> wrote:<br>
> > H264 is encoded with x264enc element.<br>
> ><br>
> > Sent from my iPhone<br>
> ><br>
> > On Dec 22, 2010, at 3:10 AM, wl2776 <<a href="mailto:wl2776@gmail.com">wl2776@gmail.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:wl2776@gmail.com">wl2776@gmail.com</a>>> wrote:<br>
> ><br>
> >><br>
> >><br>
> >> michael young wrote:<br>
> >>><br>
> >>> And now , I want to record the video to a MP4 file with the h264<br>
> encoding<br>
> >>> format , How can I do ?<br>
> >>><br>
> >>> On Wed, Dec 22, 2010 at 2:26 PM, michael <<a href="mailto:mcygogo@gmail.com">mcygogo@gmail.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:mcygogo@gmail.com">mcygogo@gmail.com</a>>> wrote:<br>
> >>><br>
> >>>> tks, this is work: gst-launch v4l2src device=/dev/video0 !<br>
> >>>> 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! xvimagesink<br>
> >>><br>
> >>><br>
> >><br>
> >> Looks like you can't, because h264 encoder is unavailable.<br>
> >> gst-inspect | grep h264<br>
> >> doesn't show it.<br>
> >> However, general idea is to encode, then mux, and then save to a file.<br>
> >> gst-launch v4l2src device=/dev/video0 !<br>
> >> 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! ffenc_mpeg4 !<br>
> >> mp4mux !filesink location=/home/user/file.<br>
> >><br>
> >> --<br>
> >> View this message in context:<br>
> >><br>
> <a href="http://gstreamer-devel.966125.n4.nabble.com/how-to-create-a-pipeline-to-record-video-from-camera-tp3134399p3160261.html" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/how-to-create-a-pipeline-to-record-video-from-camera-tp3134399p3160261.html</a><br>
> >> Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
> >><br>
> >><br>
> ------------------------------------------------------------------------------<br>
> >> Forrester recently released a report on the Return on Investment<br>
> (ROI) of<br>
> >> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even<br>
> >> within 7 months. Over 3 million businesses have gone Google with Google<br>
> >> Apps:<br>
> >> an online email calendar, and document program that's accessible<br>
> from your<br>
> >><br>
> >> browser. Read the Forrester report: <a href="http://p.sf.net/sfu/googleapps-sfnew" target="_blank">http://p.sf.net/sfu/googleapps-sfnew</a><br>
> >> _______________________________________________<br>
> >> gstreamer-devel mailing list<br>
> >> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
</div>> <mailto:<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a>><br>
<div class="im">> >> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
> ><br>
> ><br>
> ------------------------------------------------------------------------------<br>
> > Forrester recently released a report on the Return on Investment (ROI) of<br>
> > Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even<br>
> > within 7 months. Over 3 million businesses have gone Google with Google<br>
> > Apps:<br>
> > an online email calendar, and document program that's accessible from<br>
> your<br>
> > browser. Read the Forrester report: <a href="http://p.sf.net/sfu/googleapps-sfnew" target="_blank">http://p.sf.net/sfu/googleapps-sfnew</a><br>
> > _______________________________________________<br>
> > gstreamer-devel mailing list<br>
> > <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
</div>> <mailto:<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a>><br>
<div><div></div><div class="h5">> > <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
> ><br>
</div></div></blockquote></div><br></div>