frame-by-frame stepping with shorter video-track
Ingo Randolf (Servus)
ingo.randolf at servus.at
Wed Dec 3 09:20:15 PST 2014
Hello.
i am using gstreamer to do a frame-by-frame transformation of a movie file.
for that i use a playbin with an appsink in paused state, performing a
seek(gst_element_seek_simple) to jump to the next video-frame after a
frame was transformed.
i ran into problems with files in which the video-track is shorter than
the file itself when pulling a frame from a position after the last
video frame but before the file ends.
in this case gst_app_sink_pull_preroll never returns due to an invalid
position in the video-track.
a testprogram and movie file can be downloaded here:
www.bildstrom.at/dl/gst_framebyframe.zip
it is just ~65KB
the zip-file contains the test-aplication and a testmovie with which
this problem occurs.
the application takes 2 arguments:
1: path to file (e.g.: file:///path/to/testmovie.mov)
2: frame-stepping [0|1]
the video-file has an audio track 2.0 seconds long, the video-track is
1.75 seconds long.
the problem can be solved by surrounding gst_app_sink_pull_preroll with
a gst_element_query_position on the appsink.
(see: appsink_framebyframe.c)
is this the way to go?
maybe gst_app_sink_pull_preroll should take care about an invalid
position instead?
a related question:
how do i get the duration of the video-track?
querying the pipeline or the appsink with gst_element_query_duration
both times gives back the file-length.
with attached movie-snipped the duration i get in both cases is 2.0 seconds.
(see: appsink_framebyframe.c)
thanks
ingo
More information about the gstreamer-devel
mailing list