Python: procedural video and audio mix in

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Python: procedural video and audio mix in

Mikko Ohtamaa
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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python: procedural video and audio mix in

Kapil Agrawal
Yes thats possible.

On Sat, Aug 6, 2011 at 11:52 AM, Mikko Ohtamaa <[hidden email]> 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
[hidden email]
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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python: procedural video and audio mix in

Mikko Ohtamaa
Hi Kapil,

On Sat, Aug 6, 2011 at 9:40 AM, Kapil Agrawal <[hidden email]> 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
> <[hidden email]> 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
>> [hidden email]
>> 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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python: procedural video and audio mix in

Kapil Agrawal
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 ,

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 <[hidden email]> wrote:
Hi Kapil,

On Sat, Aug 6, 2011 at 9:40 AM, Kapil Agrawal <[hidden email]> 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
> <[hidden email]> 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
>> [hidden email]
>> 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
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
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
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Python: procedural video and audio mix in

Mikko Ohtamaa-2
On Sat, Aug 6, 2011 at 10:12 AM, Kapil Agrawal <[hidden email]> 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
> <[hidden email]> wrote:
>>
>> Hi Kapil,
>>
>> On Sat, Aug 6, 2011 at 9:40 AM, Kapil Agrawal <[hidden email]> 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
>> > <[hidden email]> 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
>> >> [hidden email]
>> >> 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
>> > [hidden email]
>> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> >
>> >
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> 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
> [hidden email]
> 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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Fwd: Python: procedural video and audio mix in

Mikko Ohtamaa
On Sat, Aug 6, 2011 at 10:12 AM, Kapil Agrawal <[hidden email]> 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
 # XXX: how to create a video frame in GStreamer pipeline in this
point based on the image data created above

... 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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Python: procedural video and audio mix in

Nathanael D. Noblet
Perhaps look at appsrc and the signals it provides. I've never done this
but assume that that element would be what you are looking for. You'd
then listen for some signal it emits and provide it with data when it
asked for it.



On 08/06/2011 01:39 AM, Mikko Ohtamaa wrote:

> On Sat, Aug 6, 2011 at 10:12 AM, Kapil Agrawal<[hidden email]>  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
>   # XXX: how to create a video frame in GStreamer pipeline in this
> point based on the image data created above
>
> ... 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
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Python: procedural video and audio mix in

Stefan Sauer
In reply to this post by Mikko Ohtamaa
On 08/06/11 09:39, Mikko Ohtamaa wrote:

> On Sat, Aug 6, 2011 at 10:12 AM, Kapil Agrawal <[hidden email]> 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
>  # XXX: how to create a video frame in GStreamer pipeline in this
> point based on the image data created above

you can use appsrc or better write an own source element. The own source
element is the better strategy (although there might be not so many
examples for writing that from python).

Stefan

> ... 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
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel