I am trying to construct a C application that can either pick up
audio/video from a file (mpeg transport stream) or receive mpeg transport stream on a UDP socket. Input format is MPEG2 A/V and output is H.264 with MPEG audio or AAC, transport stream multiplexing on output. So far I have managed to transcode video from network but am getting buffer underruns on the queue. If I add audio everything just stops, the pipeline does nothing and I can't quite figure out why. If I read the data from a file, I get buffer overruns. So clearly this is a clocking thing. I have searched for documentation regarding clocking in gstreamer but found nothing useful. The app developers manual mentions clocking but nothing about how it applies to code, and gst-inspect says none of the elements I have looked at have any clocking capabilities?!f Anyway, I was wondering if anyone had an example for building an MPEG transcoding pipeline in C, for working with a live stream and not file input, file output. File input, network output would be the other scenario. Baldur Gislason ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Hi,
sorry for the late reply. I hope it will help. On Fri, Sep 10, 2010 at 7:52 PM, Baldur Gislason <[hidden email]> wrote: I am trying to construct a C application that can either pick up audio/video from a file (mpeg transport stream) or receive mpeg transport stream on a UDP socket. I don't have many details about how your pipelines ar4e built, but in 90% of the cases the behaviour you're observing is due to a missing queue at the right point. The audio thread should be straightforward from source to sink, while one queue element should be separating the video thread before the muxer. If I read the data from a file, I get buffer overruns. So clearly this is a clocking thing. I have searched for documentation regarding clocking in gstreamer but found nothing useful. You can find something here: http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-clocks.txt and here: http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-scheduling.txt http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synchronisation.txt The app developers manual mentions clocking but nothing about how it applies to code, and gst-inspect says none of the elements I have looked at have any clocking capabilities?!f See here the excellent guide (should be from Mark Nauwelaerts): http://gentrans.sourceforge.net/docs/head/manual/html/howto.html Regards
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
I went back to basics, building some test pipelines by hand with gst-launch.
Same result as before, if I create the pipeline with decodebin or decodebin2, I get output but the performance is terrible, maxes one core at 100% and real time transcoding becomes impossible. If I construct a pipeline by hand using mpegtsdemux, mpeg2dec, x264enc and mpegtsmux, transcoding video only works great, and performance is as expected, using about 20% CPU time on this quad core Xeon E5507 machine. However when I try to pass audio through that pipeline, I get a deadlock somewhere and nothing comes out of the TS mux. Decodebin pipeline that works but performs very bad: gst-launch-0.10 -v mpegtsmux name ="mux" ! filesink location="/home/baldur/launch.ts" \ udpsrc multicast-group="239.192.192.1" port=1234 ! decodebin2 name="d" { d. ! queue ! x264enc key-int-max=50 ip-factor=0.71 analyse=0x113 me=0 subme=1 bframes=3 trellis=0 interlaced=1 ! queue max-size-buffers=16384 ! mux. } \ { d. ! audioconvert ! audioresample ! ffenc_aac ! queue max-size-time=10000000000 ! mux. } Discrete pipeline that works and performs great for video only: gst-launch-0.10 -v mpegtsmux name ="mux" ! filesink location="/home/baldur/launch.ts" \ udpsrc multicast-group="239.192.192.1" port=1234 ! mpegtsdemux name="d" { d. ! queue ! mpeg2dec ! x264enc key-int-max=50 ip-factor=0.71 analyse=0x113 me=0 subme=1 bframes=3 trellis=0 interlaced=1 ! queue ! mux. } Discrete pipeline that does not feed anything through it, CPU usage goes up for a while, until it fills some queue I guess and then it stops. Nothing is ever written to the filesink: gst-launch-0.10 -v mpegtsmux name ="mux" ! filesink location="/home/baldur/launch.ts" \ udpsrc multicast-group="239.192.192.1" port=1234 ! mpegtsdemux name="d" { d. ! queue ! mpegvideoparse ! mpeg2dec ! x264enc key-int-max=50 ip-factor=0.71 analyse=0x113 me=0 subme=1 bframes=3 trellis=0 interlaced=1 ! queue ! mux. } \ { d.audio_%04x ! queue max-size-time=10000000000 max-size-buffers=16384 ! mp3parse ! mux. } Another discrete that feeds nothing: gst-launch-0.10 -v mpegtsmux name ="mux" ! filesink location="/home/baldur/launch.ts" \ udpsrc multicast-group="239.192.192.1" port=1234 ! mpegtsdemux name="d" { d. ! queue ! mpegvideoparse ! mpeg2dec ! x264enc key-int-max=50 ip-factor=0.71 analyse=0x113 me=0 subme= 1 bframes=3 trellis=0 interlaced=1 ! queue ! mux. } \ { d. ! queue ! ffdec_mp3 ! audioconvert ! audioresample ! ffenc_aac ! queue ! mux. } I have tried a bunch of configurations on the audio side, but can't seem to get any audio through. Output from gst-launch for decodebin based pipeline: http://pastebin.com/LRUnZhEf I don't see anything in the output that I am missing from the other pipeline. Baldur On Sat, Sep 18, 2010 at 2:31 PM, Marco Ballesio <[hidden email]> wrote: > Hi, > > sorry for the late reply. I hope it will help. > > On Fri, Sep 10, 2010 at 7:52 PM, Baldur Gislason <[hidden email]> wrote: >> >> I am trying to construct a C application that can either pick up >> audio/video from a file (mpeg transport stream) or receive mpeg transport >> stream on a UDP socket. >> Input format is MPEG2 A/V and output is H.264 with MPEG audio or AAC, >> transport stream multiplexing on output. >> So far I have managed to transcode video from network but am getting >> buffer underruns on the queue. If I add audio everything just stops, the >> pipeline does nothing and I can't quite figure out why. > > I don't have many details about how your pipelines ar4e built, but in 90% of > the cases the behaviour you're observing is due to a missing queue at the > right point. The audio thread should be straightforward from source to sink, > while one queue element should be separating the video thread before the > muxer. > >> >> If I read the data from a file, I get buffer overruns. So clearly this is >> a clocking thing. I have searched for documentation regarding clocking in >> gstreamer but found nothing useful. > > You can find something here: > > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-clocks.txt > > and here: > > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-scheduling.txt > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synchronisation.txt > >> >> The app developers manual mentions clocking but nothing about how it >> applies to code, and gst-inspect says none of the elements I have looked at >> have any clocking capabilities?!f >> >> Anyway, I was wondering if anyone had an example for building an MPEG >> transcoding pipeline in C, for working with a live stream and not file >> input, file output. File input, network output would be the other >> scenario. > > See here the excellent guide (should be from Mark Nauwelaerts): > > http://gentrans.sourceforge.net/docs/head/manual/html/howto.html > > Regards > >> >> Baldur Gislason >> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > > ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Ok. I have reached a point where the pipeline is functional and performs as expected.
gst-launch-0.10 -v -m mpegtsmux name ="mux" ! filesink location="/home/baldur/launch.ts" \ udpsrc multicast-group="239.192.192.1" port=1234 ! mpegtsdemux name="d" \ { d. ! mpeg2dec ! x264enc key-int-max=50 ip-factor=0.71 analyse=0x113 me=0 subme=1 bframes=3 trellis=0 interlaced=1 ! queue max-size-time=0 max-size-buffers=0 ! mux. } \ { d. ! queue max-size-time=0 max-size-buffers=0 ! mux. } It seems I was just running out of queue space to synchronise the outputs, which did not happen in the same manner with decodebin. Baldur ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |