Python: procedural video and audio mix in

Mikko Ohtamaa mikko+python at redinnovation.com
Sat Aug 6 00:38:32 PDT 2011


On Sat, Aug 6, 2011 at 10:12 AM, Kapil Agrawal <kapil.agl at gmail.com> wrote:
> What do you mean by dumping video frames from python to gstreamer. So for
> example if you want to write a gstreamer pipeline for doing gst-launch-0.10
> filesrc location=test.mp4 ! decodebin2 ! xvimagesink ,

For example I generate a series of images like this:

for frame in range(0, 10000): # let's render 10000 frames of video
  data = []
  for y in range(0, height):
      for x in range(0, width):
            data[y*width+x] = random.randint(0, 2**31) # rgba pixel

... now, how do I feed this raw image data to gstreamer, so that it'll
put it to the video track alongside audio coming from a file.

I probably need to interact with buffers somehow, but I didn't find
example and I am very clueless with GStreamer, so if anyone could
point me to the right direction I'd be happy.

Hope this helps,
Mikko


>
> you can write the app in python, and gstreamer will take care of calling
> appropriate api.
>
> Best
> Kapil
>
> On Sat, Aug 6, 2011 at 12:17 PM, Mikko Ohtamaa
> <mikko+gstreamer at redinnovation.com> wrote:
>>
>> Hi Kapil,
>>
>> On Sat, Aug 6, 2011 at 9:40 AM, Kapil Agrawal <kapil.agl at gmail.com> wrote:
>> > Yes thats possible.
>>
>> Thank you for confirming this. Are there any examples how to dump
>> video frames from Python to GStreamer?
>>
>> -Mikko
>>
>> >
>> > On Sat, Aug 6, 2011 at 11:52 AM, Mikko Ohtamaa
>> > <mikko+gstreamer at redinnovation.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I am planning to generate videos in Python code. I was wondering if
>> >> GStreamer Python APIs allow one to
>> >>
>> >> * Set video FPS, dimensions and such properties
>> >>
>> >> * Set audio source file (MP3)
>> >>
>> >> * Feed in rendered frames
>> >>
>> >> * Save the encoded output in MPEG-4 (audio will get mixed in)
>> >>
>> >> I didn't find any GStreamer Python examples where video was actually
>> >> generated - thus I wanted to ask whether Python bindings provide
>> >> necessary bridges and datatype mappings to input raw video data to
>> >> GStreamer.
>> >>
>> >> This all would run on headless server software.
>> >>
>> >> Related stackoverflow.com questions:
>> >>
>> >>
>> >>
>> >> http://stackoverflow.com/questions/6963302/gstreamer-status-of-python-bindings-and-encoding-video-with-mixed-audio
>> >>
>> >> Thanks for help!
>> >> -Mikko
>> >> _______________________________________________
>> >> gstreamer-devel mailing list
>> >> gstreamer-devel at lists.freedesktop.org
>> >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> >
>> >
>> >
>> > --
>> > www.mediamagictechnologies.com (Gstreamer, ffmpeg, Red5, Streaming)
>> > twitter handle: @gst_kaps
>> > http://www.linkedin.com/in/kapilagrawal
>> >
>> > _______________________________________________
>> > gstreamer-devel mailing list
>> > gstreamer-devel at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> >
>> >
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> --
> www.mediamagictechnologies.com (Gstreamer, ffmpeg, Red5, Streaming)
> twitter handle: @gst_kaps
> http://www.linkedin.com/in/kapilagrawal
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>



-- 
Mikko Ohtamaa
mFabrik - Freedom Delivered.

Web site - http://mfabrik.com
Mobile site - http://mfabrik.mobi
Blog - http://blog.mfabrik.com


More information about the gstreamer-devel mailing list