[gst-devel] how to create a pipeline to record video from camera?
Cai Yuanqing
yuanqing.cai at tieto.com
Thu Dec 23 09:34:26 CET 2010
Hi Michael:
I tried command below and it works well:
$ gst-launch-0.10 -e v4l2src num-buffers=200 !
'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! ffmpegcolorspace
! ffenc_mpeg4 ! mp4mux ! filesink location=test1.mp4
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 6682641000 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 640x480 => 640x480 Planar YV12
V: 0.4 0/ 0 5% 0% 0.0% 0 0
Exiting... (End of file)
Seems that you just can record MP4 file but can't playback.
maybe you can try the command below to playback it in command line:
$ gst-launch-0.10 filesrc location=test1.mp4 !
ffdemux_mov_mp4_m4a_3gp_3g2_mj2 ! ffdec_mpeg4 !
'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! ffmpegcolorspace
! xvimagesink
BTW,you could use gst-inspect-0.10 as much as possible to guess and try
the elements you want.
On 12/23/2010 03:26 PM, michael wrote:
> My Gstreamer and Plugins version is :
> gst-ffmpeg-0.10.11
> gst-plugins-bad-0.10.20
> gst-plugins-base-0.10.30
> gst-plugins-good-0.10.25
> gst-plugins-ugly-0.10.16
> gstreamer-0.10.30
> So I think the version is ok, isn't it?
> and the all plugin can run, so I think the supported library packages
> is ready.
>
> On Thu, Dec 23, 2010 at 3:06 PM, sudarshan bisht
> <bisht.sudarshan at gmail.com <mailto:bisht.sudarshan at gmail.com>> wrote:
>
>
> Make sure you have all latest Gstreamer core, plugins and
> supported library packages installed.
>
>
> On Thu, Dec 23, 2010 at 12:22 PM, michael <mcygogo at gmail.com
> <mailto:mcygogo at gmail.com>> wrote:
>
> Really!!?? but it's not work on my book!! God,, this issue
> drives me crazy!! :(
>
>
> On Thu, Dec 23, 2010 at 2:42 PM, liJin <lijinsyam at gmail.com
> <mailto:lijinsyam at gmail.com>> wrote:
>
> Hi
>
>
> gst-launch -e v4l2src !
> 'video/x-raw-yuv,width=320,height=240, framerate=30/1' !
> ffmpegcolorspace ! x264enc ! mp4mux ! filesink location=1.mp4
>
> This pipeline working fine (4 me)......:)
>
>
> On Thu, Dec 23, 2010 at 12:08 PM, michael
> <mcygogo at gmail.com <mailto:mcygogo at gmail.com>> wrote:
>
> Is there nobody know how to record video from camera
> to a MP4 container with the H264 encoding ?
>
>
> On Thu, Dec 23, 2010 at 9:46 AM, michael
> <mcygogo at gmail.com <mailto:mcygogo at gmail.com>> wrote:
>
> neither qtmux nor mp4mux is not work well
>
>
> On Wed, Dec 22, 2010 at 11:24 PM, Timothy Braun
> <braunsquared at gmail.com
> <mailto:braunsquared at gmail.com>> wrote:
>
> Not qtmux, use mp4mux.
>
>
> On Wed, Dec 22, 2010 at 10:10 AM, michael
> <mcygogo at gmail.com <mailto:mcygogo at gmail.com>>
> wrote:
>
> I have tested changing the muxer to qtmux,
> but it still not work
>
>
> On Wed, Dec 22, 2010 at 10:58 PM, Timothy
> Braun <braunsquared at gmail.com
> <mailto:braunsquared at gmail.com>> wrote:
>
> 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
> <mailto: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
>> <mailto: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
>> <mailto: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>
>> >
>> <mailto: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>
>> > <mailto: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>
>> > <mailto: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
>> <http://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>
>> >
>> <mailto: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>
>> >
>> <mailto: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
>> <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
> <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
> <mailto:gstreamer-devel at lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One
> Node allows customers
> to consolidate database storage, standardize their
> database environment, and,
> should the need arise, upgrade to a full multi-node
> Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
>
> _______________________________________________
> 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
>
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node
> allows customers
> to consolidate database storage, standardize their
> database environment, and,
> should the need arise, upgrade to a full multi-node Oracle
> RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> 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
>
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node
> allows customers
> to consolidate database storage, standardize their database
> environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC
> database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> 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
>
>
>
>
> --
> Regards,
>
> Sudarshan Bisht
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows
> customers
> to consolidate database storage, standardize their database
> environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC
> database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> 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
>
>
--
B.R
Cai Yuanqing
More information about the gstreamer-devel
mailing list