[gst-devel] how to create a pipeline to record video from camera?
Timothy Braun
braunsquared at gmail.com
Wed Dec 22 15:58:01 CET 2010
I was never able to get the ffmpeg mpeg4 mixer to work quite right. I found that mp4mux, an extension of qtmux, works much better. If you inspect the ffmpeg mp4 muxer they actually suggest that you use a different one as it's unstable.
Best,
Tim
Sent from my iPhone
On Dec 22, 2010, at 8:27 AM, michael <mcygogo at gmail.com> wrote:
> I just ran it :
> gst-launch -e v4l2src num-buffers=200 ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! ffmpegcolorspace ! ffenc_mpeg4 ! mp4mux ! filesink location=record.mp4
> And got a mp4 file , but it still cannot be playbacked, and give the error info:
> Playing record.mp4.
> libavformat file format detected.
> [mpeg4 @ 0x9376c10]hmm, seems the headers are not complete, trying to guess time_increment_bits
> [mpeg4 @ 0x9376c10]my guess is 5 bits ;)
> [mpeg4 @ 0x9376c10]looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag
> [mpeg4 @ 0x9376c10]picture size invalid (0x0)
> [mpeg4 @ 0x9376c10]get_buffer() failed (-1 0 0 (nil))
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x9375640]Could not find codec parameters (Video: mpeg4, yuv420p)
> LAVF_header: av_find_stream_info() failed
> ISO: File Type Major Brand: ISO/IEC 14496-1 (MPEG-4 system) v2
> Quicktime/MOV file format detected.
> [mov] Video stream found, -vid 0
> VIDEO: [mp4v] 640x480 24bpp inf fps 0.0 kbps ( 0.0 kbyte/s)
> open: No such file or directory
> [MGA] Couldn't open: /dev/mga_vid
> open: No such file or directory
> [MGA] Couldn't open: /dev/mga_vid
> [VO_TDFXFB] Can't open /dev/fb0: Permission denied.
> [VO_3DFX] Unable to open /dev/3dfx.
> ==========================================================================
> Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
> Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
> ==========================================================================
> Audio: no sound
> Starting playback...
> VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
> VDec: using Planar YV12 as output csp (no 0)
> Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
> VO: [xv] 640x480 => 640x480 Planar YV12
> V: 0.0 200/200 ??% ??% ??,?% 0 0
>
> Exiting... (End of file)
>
> But the error info not like the old one!
>
> On Wed, Dec 22, 2010 at 9:17 PM, liJin <lijinsyam at gmail.com> wrote:
> I think thats the issue...
>
>
> gst-launch -e v4l2src ! 'video/x-raw-yuv,width=320,height=240, framerate=30/1' ! ffmpegcolorspace ! ffenc_mpeg4 ! mp4mux ! filesink location=1.mp4
>
> run with -e option
>
>
>
> On Wed, Dec 22, 2010 at 6:01 PM, Santakivi Topi <Topi.Santakivi at digia.com> wrote:
> On 12/22/2010 12:18 PM, michael wrote:
> > Now I can record the video to a AVI file with mpeg4 encoding by :
> > gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240,
> > framerate=30/1' ! ffmpegcolorspace ! ffenc_mpeg4! avimux! filesink
> > location=record.avi
> >
> > But I got two issues:
> > 1: I want record as a MP4 file, I do it like this:
> > gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240,
> > framerate=30/1' ! ffmpegcolorspace ! ffenc_mpeg4 ! mp4mux! filesink
> > location=record.avi
> > I can record the video , but when I playback it by mplayer, I got a error:
> > Playing ./record.mp4.
> > libavformat file format detected.
> > [mov,mp4,m4a,3gp,3g2,mj2 @ 0x8741640]moov atom not found
> > LAVF_header: av_open_input_stream() failed
> > ISO: File Type Major Brand: ISO/IEC 14496-1 (MPEG-4 system) v2
>
> When recording, with the above gst-launch line, do you stop
> the pipeline with Ctrl+C..?
>
> It could be that the file container doesn't get fully written
> in case of such an interrupt and that's why the clip doesn't play.
>
> For example, if you use this pipeline and
> stop it with Ctrl+C, the clip doesn't play:
>
> gst-launch-0.10 videotestsrc !
> 'video/x-raw-yuv,width=320,height=240,framerate=30/1' ! ffmpegcolorspace
> ! ffenc_mpeg4 ! mp4mux ! filesink location=test.mp4
>
> But this pipeline produces a valid video file:
>
> gst-launch-0.10 videotestsrc num-buffers=200 !
> 'video/x-raw-yuv,width=320,height=240,framerate=30/1' ! ffmpegcolorspace
> ! ffenc_mpeg4 ! mp4mux ! filesink location=test.mp4
>
> >
> > 2: I want encode the video to H264, so I do like this:
> > gst-launch v4l2src ! 'video/x-raw-yuv,width=320,height=240,
> > framerate=30/1' ! ffmpegcolorspace ! x264enc! avimux ! filesink
> > location=record.avi
>
> How about adding the format to the caps, e.g .
> v4l2src ! 'video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,
> framerate=30/1' ! fmpegcolorspace ! x264enc! avimux ! filesink
> location=record.avi ?
>
> BR,
> Topi
>
> > But when I run the pipeline I just get the error info like this:
> > Setting pipeline to PAUSED ...
> > Pipeline is live and does not need PREROLL ...
> > Setting pipeline to PLAYING ...
> > New clock: GstSystemClock
> > ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal
> > data flow error.
> > Additional debug info:
> > gstbasesrc.c(2550): gst_base_src_loop ():
> > /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
> > streaming task paused, reason not-negotiated (-4)
> > Execution ended after 1727716724 ns.
> > Setting pipeline to PAUSED ...
> > Setting pipeline to READY ...
> > Setting pipeline to NULL ...
> > Freeing pipeline ...
> >
> > Some one can help me fix the issues? Tks :)
> >
> >
> > On 12/22/10, Timothy Braun <braunsquared at gmail.com
> > <mailto:braunsquared at gmail.com>> wrote:
> > > H264 is encoded with x264enc element.
> > >
> > > Sent from my iPhone
> > >
> > > On Dec 22, 2010, at 3:10 AM, wl2776 <wl2776 at gmail.com
> > <mailto:wl2776 at gmail.com>> wrote:
> > >
> > >>
> > >>
> > >> michael young wrote:
> > >>>
> > >>> And now , I want to record the video to a MP4 file with the h264
> > encoding
> > >>> format , How can I do ?
> > >>>
> > >>> On Wed, Dec 22, 2010 at 2:26 PM, michael <mcygogo at gmail.com
> > <mailto:mcygogo at gmail.com>> wrote:
> > >>>
> > >>>> tks, this is work: gst-launch v4l2src device=/dev/video0 !
> > >>>> 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! xvimagesink
> > >>>
> > >>>
> > >>
> > >> Looks like you can't, because h264 encoder is unavailable.
> > >> gst-inspect | grep h264
> > >> doesn't show it.
> > >> However, general idea is to encode, then mux, and then save to a file.
> > >> gst-launch v4l2src device=/dev/video0 !
> > >> 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! ffenc_mpeg4 !
> > >> mp4mux !filesink location=/home/user/file.
> > >>
> > >> --
> > >> View this message in context:
> > >>
> > http://gstreamer-devel.966125.n4.nabble.com/how-to-create-a-pipeline-to-record-video-from-camera-tp3134399p3160261.html
> > >> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> > >>
> > >>
> > ------------------------------------------------------------------------------
> > >> Forrester recently released a report on the Return on Investment
> > (ROI) of
> > >> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> > >> within 7 months. Over 3 million businesses have gone Google with Google
> > >> Apps:
> > >> an online email calendar, and document program that's accessible
> > from your
> > >>
> > >> browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> > >> _______________________________________________
> > >> gstreamer-devel mailing list
> > >> gstreamer-devel at lists.sourceforge.net
> > <mailto:gstreamer-devel at lists.sourceforge.net>
> > >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> > >
> > >
> > ------------------------------------------------------------------------------
> > > Forrester recently released a report on the Return on Investment (ROI) of
> > > Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> > > within 7 months. Over 3 million businesses have gone Google with Google
> > > Apps:
> > > an online email calendar, and document program that's accessible from
> > your
> > > browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> > > _______________________________________________
> > > gstreamer-devel mailing list
> > > gstreamer-devel at lists.sourceforge.net
> > <mailto:gstreamer-devel at lists.sourceforge.net>
> > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> > >
>
> ------------------------------------------------------------------------------
> Forrester recently released a report on the Return on Investment (ROI) of
> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> within 7 months. Over 3 million businesses have gone Google with Google Apps:
> an online email calendar, and document program that's accessible from your
> browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
> ------------------------------------------------------------------------------
> Forrester recently released a report on the Return on Investment (ROI) of
> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> within 7 months. Over 3 million businesses have gone Google with Google Apps:
> an online email calendar, and document program that's accessible from your
> browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
> ------------------------------------------------------------------------------
> Forrester recently released a report on the Return on Investment (ROI) of
> Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
> within 7 months. Over 3 million businesses have gone Google with Google Apps:
> an online email calendar, and document program that's accessible from your
> browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20101222/9bea338f/attachment.htm>
More information about the gstreamer-devel
mailing list