generating a video of multiple images and multiple audio files with python- can someone review my code?

hammerwerfer hammer.werfer at gmx.de
Sun Feb 21 12:46:21 UTC 2016


i am stumped with my problem. I want to generate a video of multiple images
and multiple audio files. I am using python with gestreamer binding. My
script (see attached file genvideo.py) already works in principle but the
audio stream stutters somehow.
In my little example i use two audio files a short.mp3 with a length of
three seconds and a long.mp3 (something above a minute). The audio files are
switched via event_probe. I stream image data directy to the video source
(need-data). After 200 frames, i send eos-events to the video source and
audio source. If i dont send an eos-event to the audio source the second
audio file the resulting video is as long as the two audio files together.
But i wanted the video to cut off after 200 frames. At 25fps the video
should have a length of 8 seconds.
The script generates a video file. The audio track switches after 3 seconds
to the next mp3 file. The second mp3 plays a few milli seconds and then it
restarts again from the beginning. Somehow this depends on the video player.
VLC plays it continously but Totem does not play it well. With Totem the
sound stops after 6 seconds. Otherwise VLC has problems with seeking in the
video file. If i change the output format to ogg/vorbis. The video plays a
little better but the video progress of VLC jumps after 3 seconds to the
beginning. It seems that it displays the progress of the two audio files.
If i reencode the resulting video with avidemux everything is perfect. I got
exactly 200 frames at 8 seconds. I guess it is just a missing sync setting
or whatever. I also tried to play around with gstreamer queues but all with
no success.
Maybe someone can check my code and give me a hint?
 
Example Script: http://sg-dev.de/genvideo.py
 
Thanks in advance,
Jens



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/generating-a-video-of-multiple-images-and-multiple-audio-files-with-python-can-someone-review-my-cod-tp4675966.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list