Video segment to file

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

Video segment to file

Peter Schwenke-2
I would like to capture a segment of a video file to file e.g. 10
seconds of video to file.  This does not need frame accuracy.

I have managed to do this for an audio file (e.g.. the C  equivalent of
gst-launch filesrc location=... ! oggdemux ! vorbisdec ! audioconvert !
lame ! filesink location=... with a seek thrown in)

I have also managed to do seeks in C programs which used both playbin
and oggdemux.

However, I haven't worked out an approach for video given that I call a
"pad-added" handler (say in the case of using oggdemux) and need to get
the output from both audio and video to the same filesrc.

I have managed to join an audio file and a video file using gst-launch
doing something along the line of (I'll omit oggdemux etc because I'm
really after a generic method for this)

filesrc ! filesrc location=audioFile ! demuxer ! audio decode !
audioconvert ! audio encode ! muxer name=muxer muxer. ! filesink
location=combined filesrc=videoFile ! demuxer ! video decode ! video
convert ! video encode ! muxer.

Does anyone have an idea on how I should approach this?

Also, if no transcoding is required what would be the simplest elements
to use between a filesrc and filesink to perform a seek.

i.e. filesrc location=.... ! queue ! filesink location=...

                                                                Regards
                                                                ...Peter

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Video segment to file

Peter Schwenke-2
I've managed to put together the following pipeline

gst-launch-0.10 ffmux_flv name=muxer ! filesink location=/tmp/z.flv
filesrc location=../../testMovies/gb_3XUtwjvk.ogg ! oggdemux
name=demuxer demuxer. ! queue ! vorbisdec ! audioconvert ! lame ! muxer.
 demuxer. ! queue ! theoradec ! ffmpegcolorspace ! ffenc_flv ! muxer.

in a python program but haven't got the seeking correct.
I have the above implemented with a bin for each of

ffmux_flv name=muxer ! filesink location=/tmp/z.flv
queue ! vorbisdec ! audioconvert ! lame
queue ! theoradec ! ffmpegcolorspace ! ffenc_flv

and
filesrc location=../../testMovies/gb_3XUtwjvk.ogg ! oggdemux

in the main pipeline.  All the links are correct.  If I run the program
without any seeks it works,

I am using

pipeline.seek(1.0, gst.Format(gst.FORMAT_TIME), gst.SEEK_FLAG_FLUSH,
gst.SEEK_TYPE_SET, start_time_nanoseconds, stop_seek_type,
stop_time_nanoseconds)

The parameters I am setting there are correct because I use the same
thing in other programs.

It seems like a timing problem - like I'm not in the correct state.

I've tried doing the seek when I receive the first async-done message on
the bus.

The only way I get something is if I set the state to STATE_PLAYING and do

gobject.timeout_add(200, self.cb_set_position, self.seek)

Then I get the first couple of seconds from the file, the part of the
result of the seek and then blank.

Of course, I would like to have the state set to STATE_PAUSED and then
do the seek.  Then after the seek set the state to STATE_PLAYING.  But
then I just get rubbish in the output file.

Does anyone have any suggestions on how I should approach this.

                                                               Thanks
                                                               ...Peter



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel