简体   繁体   中英

gstreamer and mp4 or avi output with audio

I have the syntax below that will show the video of my webcam on the screen and encode the video to an ogv file. What I would like to do is show the video on the screen but change it from an ogv file to an mp4 and/or avi file with audio being recorded can someone assist me on this.

Thanks the below code works for ogv files I'm using ubuntu 10.04 64bit Linux and a logitech c600 webcam

The code below works by itself:

gst-launch-0.10 v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \
timeoverlay halignment=right valignment=bottom shaded-background=true ! \
clockoverlay halignment=left valignment=bottom text="M/D/Y:" shaded-background=true time-format="%m/%d/%Y %H:%M:%S" ! \
tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \
'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! oggmux ! \
filesink location=testogg.ogv

I tried combining two different working sections of code to see if it would work. The top code and the bottom code

The code below works by itself;

gst-launch-0.10 videotestsrc num-buffers=250 \
! 'video/x-raw-yuv,format=(fourcc)I420,width=320,height=240,framerate=25/1' \
! xvidenc ! queue ! mux. \
audiotestsrc num-buffers=440 ! audioconvert ! 'audio/x-raw-int,rate=44100,channels=2' \
! lame ! queue ! mux. \
avimux name=mux ! filesink location=test.avi

I pieced together

The code combined doesn't work:

gst-launch-0.10 v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=25/1' ! \
timeoverlay halignment=right valignment=bottom shaded-background=true ! \
clockoverlay halignment=left valignment=bottom text="M/D/Y:" shaded-background=true time-format="%m/%d/%Y %H:%M:%S" ! \
tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \
'video/x-raw-yuv,framerate=25/1' ! xvidenc ! queue ! mux. ! \
avimux name=mux ! filesink location=testavirt.avi

however I get an error message "WARNING: erroneous pipeline: link without source element"

The reason I'm trying to use this codec is to get it to work in kdenlive which can be very particular to which codecs it will import

ok I launched gstreamer in debug mode as suggested with the code below

gst-launch-0.10 -v --gst-debug-level=3 ! v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=25/1' ! \
timeoverlay halignment=right valignment=bottom shaded-background=true ! \
clockoverlay halignment=left valignment=bottom text="M/D/Y:" shaded-background=true time-format="%m/%d/%Y %H:%M:%S" ! \
tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \
'video/x-raw-yuv,framerate=25/1' ! xvidenc ! queue ! mux. ! \
avimux name=mux ! filesink location=testavirt.avi

and it came back with this debug information

0:00:00.000783199 16068       0xade080 INFO                GST_INIT gstquery.c:107:_gst_query_initialize: init queries
0:00:00.001852610 16068       0xade080 INFO                GST_INIT gstmessage.c:73:_gst_message_initialize: init messages
0:00:00.002272948 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:350:_gst_plugin_initialize: registering 0 static plugins
0:00:00.002463561 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:255:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.002486054 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:257:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.003105961 16068       0xade080 INFO            GST_REGISTRY gstregistry.c:1611:ensure_current_registry: reading registry cache: /home/rat/.gstreamer-0.10/registry.x86_64.bin
0:00:00.019757535 16068       0xade080 INFO            GST_REGISTRY gstregistrybinary.c:614:gst_registry_binary_read_cache: loaded /home/rat/.gstreamer-0.10/registry.x86_64.bin in 0.016615 seconds
0:00:00.019860736 16068       0xade080 INFO            GST_REGISTRY gstregistry.c:1471:scan_and_update_registry: Validating plugins from registry cache: /home/rat/.gstreamer-0.10/registry.x86_64.bin
0:00:00.021184812 16068       0xade080 INFO            GST_REGISTRY gstregistry.c:1573:scan_and_update_registry: Registry cache has not changed
0:00:00.021194999 16068       0xade080 INFO            GST_REGISTRY gstregistry.c:1640:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.021201052 16068       0xade080 INFO                GST_INIT gst.c:797:init_post: GLib runtime version: 2.24.1
0:00:00.021208042 16068       0xade080 INFO                GST_INIT gst.c:799:init_post: GLib headers version: 2.24.1
0:00:00.021241674 16068       0xade080 INFO            GST_PIPELINE gstparse.c:335:gst_parse_launch_full: parsing pipeline description '! v4l2src ! video/x-raw-yuv,width=640,height=480,framerate=25/1 ! timeoverlay halignment=right valignment=bottom shaded-background=true ! clockoverlay halignment=left valignment=bottom text=M/D/Y: shaded-background=true time-format=%m/%d/%Y\ %H:%M:%S ! tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! video/x-raw-yuv,framerate=25/1 ! xvidenc ! queue ! mux. ! avimux name=mux ! filesink location=testavirt.avi '
0:00:00.022709253 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstvideo4linux2.so" loaded
0:00:00.022725847 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "v4l2src"
0:00:00.023022609 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseSrc@0xd28030> adding pad 'src'
0:00:00.024528033 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstpango.so" loaded
0:00:00.024541435 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "timeoverlay"
0:00:00.024983829 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstTextOverlay@0xd42040> adding pad 'video_sink'
0:00:00.025034224 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstTextOverlay@0xd42040> adding pad 'src'
0:00:00.025085769 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "clockoverlay"
0:00:00.025208997 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstTextOverlay@0xd4c0f0> adding pad 'video_sink'
0:00:00.025256228 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstTextOverlay@0xd4c0f0> adding pad 'src'
0:00:00.025569620 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstcoreelements.so" loaded
0:00:00.025583335 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "tee"
0:00:00.025655142 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstTee@0xc23760> adding pad 'sink'
0:00:00.025678269 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "queue"
0:00:00.025770942 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstQueue@0xd581c0> adding pad 'sink'
0:00:00.025795370 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstQueue@0xd581c0> adding pad 'src'
0:00:00.026000635 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstxvimagesink.so" loaded
0:00:00.026012901 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "xvimagesink"
0:00:00.026142535 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseSink@0xd26610> adding pad 'sink'
0:00:00.026172194 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "queue"
0:00:00.026202526 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstQueue@0xd58440> adding pad 'sink'
0:00:00.026225449 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstQueue@0xd58440> adding pad 'src'
0:00:00.027723125 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstvideorate.so" loaded
0:00:00.027735129 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "videorate"
0:00:00.027808311 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstVideoRate@0xd5f000> adding pad 'sink'
0:00:00.027834798 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstVideoRate@0xd5f000> adding pad 'src'
0:00:00.028089942 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstxvid.so" loaded
0:00:00.028101728 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "xvidenc"
0:00:00.028370479 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstXvidEnc@0xd5f1e0> adding pad 'sink'
0:00:00.028400842 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstXvidEnc@0xd5f1e0> adding pad 'src'
0:00:00.028481732 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "queue"
0:00:00.028508557 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstQueue@0xd586c0> adding pad 'sink'
0:00:00.028536913 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstQueue@0xd586c0> adding pad 'src'
0:00:00.029064786 16068       0xade080 INFO      GST_PLUGIN_LOADING gstplugin.c:859:gst_plugin_load_file: plugin "/usr/lib/gstreamer-0.10/libgstavi.so" loaded
0:00:00.029077092 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "avimux"
0:00:00.029284486 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstAviMux@0xd73000> adding pad 'src'
0:00:00.029326884 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "filesink"
0:00:00.029378045 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseSink@0xd75370> adding pad 'sink'
0:00:00.029412649 16068       0xade080 INFO                filesink gstfilesink.c:306:gst_file_sink_set_location: filename : testavirt.avi
0:00:00.029420428 16068       0xade080 INFO                filesink gstfilesink.c:307:gst_file_sink_set_location: uri      : file:///home/rat/testavirt.avi
0:00:00.029433307 16068       0xade080 ERROR           GST_PIPELINE ./grammar.y:799:_gst_parse_yyparse: link without source element
0:00:00.029446312 16068       0xade080 ERROR           GST_PIPELINE ./grammar.y:862:_gst_parse_yyparse: link without source element
0:00:00.029456839 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "pipeline"
0:00:00.029535187 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking v4l2src0:(any) to timeoverlay0:(any) (0/0) with caps "video/x-raw-yuv, width=(int)640, height=(int)480, framerate=(fraction)25/1"
0:00:00.029561950 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "capsfilter"
0:00:00.029628904 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseTransform@0xd78150> adding pad 'sink'
0:00:00.029654353 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseTransform@0xd78150> adding pad 'src'
0:00:00.029668706 16068       0xade080 INFO              GST_STATES gstbin.c:1767:gst_bin_get_state_func:<pipeline0> getting state
0:00:00.029686262 16068       0xade080 INFO              GST_STATES gstelement.c:2408:gst_element_continue_state:<capsfilter0> completed state change to NULL
0:00:00.029703721 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element v4l2src0:(any) to element capsfilter0:sink
0:00:00.029712366 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:969:gst_element_get_static_pad: found pad capsfilter0:sink
0:00:00.029720912 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: v4l2src0 and capsfilter0 in same bin, no need for ghost pads
0:00:00.029744719 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link v4l2src0:src and capsfilter0:sink
0:00:00.049689595 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked v4l2src0:src and capsfilter0:sink, successful
0:00:00.049761719 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element capsfilter0:src to element timeoverlay0:(any)
0:00:00.049782927 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:969:gst_element_get_static_pad: found pad capsfilter0:src
0:00:00.049801288 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link capsfilter0:src and timeoverlay0:video_sink
0:00:00.050467449 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: capsfilter0 and timeoverlay0 in same bin, no need for ghost pads
0:00:00.050498205 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link capsfilter0:src and timeoverlay0:video_sink
0:00:00.051365172 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked capsfilter0:src and timeoverlay0:video_sink, successful
0:00:00.051410274 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking timeoverlay0:(any) to clockoverlay0:(any) (0/0) with caps "(NULL)"
0:00:00.051435266 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element timeoverlay0:(any) to element clockoverlay0:(any)
0:00:00.051452770 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link timeoverlay0:src and clockoverlay0:video_sink
0:00:00.052124174 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: timeoverlay0 and clockoverlay0 in same bin, no need for ghost pads
0:00:00.052152481 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link timeoverlay0:src and clockoverlay0:video_sink
0:00:00.052819379 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked timeoverlay0:src and clockoverlay0:video_sink, successful
0:00:00.052851632 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking clockoverlay0:(any) to t_vid:(any) (0/0) with caps "(NULL)"
0:00:00.052872037 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element clockoverlay0:(any) to element t_vid:(any)
0:00:00.052888711 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link clockoverlay0:src and t_vid:sink
0:00:00.053539972 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: clockoverlay0 and t_vid in same bin, no need for ghost pads
0:00:00.053567822 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link clockoverlay0:src and t_vid:sink
0:00:00.054209057 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked clockoverlay0:src and t_vid:sink, successful
0:00:00.054240988 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking t_vid:(any) to queue0:(any) (0/0) with caps "(NULL)"
0:00:00.054261353 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element t_vid:(any) to element queue0:(any)
0:00:00.054357775 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<t_vid> adding pad 'src0'
0:00:00.054391930 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: t_vid and queue0 in same bin, no need for ghost pads
0:00:00.054416401 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link t_vid:src0 and queue0:sink
0:00:00.055097197 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked t_vid:src0 and queue0:sink, successful
0:00:00.055131050 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking queue0:(any) to xvimagesink0:(any) (0/0) with caps "(NULL)"
0:00:00.055151268 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element queue0:(any) to element xvimagesink0:(any)
0:00:00.055167783 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link queue0:src and xvimagesink0:sink
0:00:00.055842243 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: queue0 and xvimagesink0 in same bin, no need for ghost pads
0:00:00.055870005 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link queue0:src and xvimagesink0:sink
0:00:00.056567773 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked queue0:src and xvimagesink0:sink, successful
0:00:00.056606717 16068       0xade080 INFO           GST_PARENTAGE gstbin.c:3707:gst_bin_get_by_name: [pipeline0]: looking up child element t_vid
0:00:00.056632626 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking t_vid:t_vid to queue1:(any) (0/0) with caps "(NULL)"
0:00:00.056651644 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element t_vid:(any) to element queue1:(any)
0:00:00.056719250 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<t_vid> adding pad 'src1'
0:00:00.056741754 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: t_vid and queue1 in same bin, no need for ghost pads
0:00:00.056764926 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link t_vid:src1 and queue1:sink
0:00:00.057431047 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked t_vid:src1 and queue1:sink, successful
0:00:00.057462976 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking queue1:(any) to videorate0:(any) (0/0) with caps "(NULL)"
0:00:00.057520574 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element queue1:(any) to element videorate0:(any)
0:00:00.057541803 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link queue1:src and videorate0:sink
0:00:00.058218898 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: queue1 and videorate0 in same bin, no need for ghost pads
0:00:00.058247509 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link queue1:src and videorate0:sink
0:00:00.058913420 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked queue1:src and videorate0:sink, successful
0:00:00.058945216 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking videorate0:(any) to xvidenc0:(any) (0/0) with caps "video/x-raw-yuv, framerate=(fraction)25/1"
0:00:00.058980252 16068       0xade080 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:375:gst_element_factory_create: creating element "capsfilter"
0:00:00.059030050 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseTransform@0xd78410> adding pad 'sink'
0:00:00.059070176 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<GstBaseTransform@0xd78410> adding pad 'src'
0:00:00.059099030 16068       0xade080 INFO              GST_STATES gstbin.c:1767:gst_bin_get_state_func:<pipeline0> getting state
0:00:00.059133982 16068       0xade080 INFO              GST_STATES gstelement.c:2408:gst_element_continue_state:<capsfilter1> completed state change to NULL
0:00:00.059161447 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element videorate0:(any) to element capsfilter1:sink
0:00:00.059178858 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:969:gst_element_get_static_pad: found pad capsfilter1:sink
0:00:00.059192810 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: videorate0 and capsfilter1 in same bin, no need for ghost pads
0:00:00.059215498 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link videorate0:src and capsfilter1:sink
0:00:00.059916866 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked videorate0:src and capsfilter1:sink, successful
0:00:00.059949637 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element capsfilter1:src to element xvidenc0:(any)
0:00:00.059966690 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:969:gst_element_get_static_pad: found pad capsfilter1:src
0:00:00.059982820 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link capsfilter1:src and xvidenc0:sink
0:00:00.060795894 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: capsfilter1 and xvidenc0 in same bin, no need for ghost pads
0:00:00.060824501 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link capsfilter1:src and xvidenc0:sink
0:00:00.061632768 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked capsfilter1:src and xvidenc0:sink, successful
0:00:00.083857679 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking xvidenc0:(any) to queue2:(any) (0/0) with caps "(NULL)"
0:00:00.083881589 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element xvidenc0:(any) to element queue2:(any)
0:00:00.083891480 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link xvidenc0:src and queue2:sink
0:00:00.083904166 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: xvidenc0 and queue2 in same bin, no need for ghost pads
0:00:00.083914692 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link xvidenc0:src and queue2:sink
0:00:00.083925117 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked xvidenc0:src and queue2:sink, successful
0:00:00.083937094 16068       0xade080 INFO           GST_PARENTAGE gstbin.c:3707:gst_bin_get_by_name: [pipeline0]: looking up child element mux
0:00:00.083947729 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking queue2:(any) to mux:mux (0/0) with caps "(NULL)"
0:00:00.083955323 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element queue2:(any) to element mux:(any)
0:00:00.084035330 16068       0xade080 INFO        GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<mux> adding pad 'video_00'
0:00:00.084049981 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: queue2 and mux in same bin, no need for ghost pads
0:00:00.084060734 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link queue2:src and mux:video_00
0:00:00.084075560 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked queue2:src and mux:video_00, successful
0:00:00.084087455 16068       0xade080 INFO            GST_PIPELINE ./grammar.y:568:gst_parse_perform_link: linking mux:(any) to filesink0:(any) (0/0) with caps "(NULL)"
0:00:00.084095861 16068       0xade080 INFO        GST_ELEMENT_PADS gstutils.c:1694:gst_element_link_pads_full: trying to link element mux:(any) to element filesink0:(any)
0:00:00.084103574 16068       0xade080 INFO                GST_PADS gstutils.c:1028:gst_pad_check_link: trying to link mux:src and filesink0:sink
0:00:00.084114625 16068       0xade080 INFO                GST_PADS gstutils.c:1592:prepare_link_maybe_ghosting: mux and filesink0 in same bin, no need for ghost pads
0:00:00.084124013 16068       0xade080 INFO                GST_PADS gstpad.c:1956:gst_pad_link_prepare: trying to link mux:src and filesink0:sink
0:00:00.084131937 16068       0xade080 INFO                GST_PADS gstpad.c:2139:gst_pad_link_full: linked mux:src and filesink0:sink, successful
WARNING: erroneous pipeline: link without source element
rat@ubu64:~$ 

If you want to use mp4 or avi, you will need to use a different encoder. I recommend h264 or mp4v. h264enc is in the ugly plugins package.

If you want to go the mp4 route, maybe use mp4v for video and mp4a for your audio. I don't have my linux box up at the moment, so this will probably not be perfect.

gst-launch v4l2src ! your caps ! other elements ! tee name=t_vid ! \
  xvimagesink sync=false t_vid. ! queue ! caps adjustment if you need it ! \
  x264enc ! queue ! avi_mux.  \
  alsasrc ! caps ! faac (or whatever will go with avi) ! avimux name=avi_mux ! \
  filesink location=testavi.avi

Here is the avi version. Obviously you can adjust the encoders to whatever formats will work with the container. If you use the mp4mux it is very similar, just swap out my avimux stuff with the mp4mux.

You may need to tweek the alsamixer to make sure that the pipeline captures from your webcam and not one of your mic jacks.

In addition, you may need to make the queue buffers unlimited to decrease latency.

Here's what I finally pieced together thanks to Jonathan Henson if anyone is interested

gst-launch-0.10 v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \
timeoverlay halignment=right valignment=bottom shaded-background=true ! \
clockoverlay halignment=left valignment=bottom text="M/D/Y:" shaded-background=true time-format="%m/%d/%Y %H:%M:%S" ! \
tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! videorate ! \
'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! mux.  \
alsasrc device=plughw:1,0 ! audio/x-raw-int,rate=8000,channels=1,depth=16 ! \
audioconvert ! vorbisenc ! queue ! mux. \
oggmux name=mux ! filesink location=testogg.ogv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM