GES use a still frame from another video
Andrei Vasiliu
avisandrei at gmail.com
Mon Jan 12 08:14:10 PST 2015
Hi,
Have a video file (video_file.mp4) of 10 sec
Need to play 15 sec of video as follows:
- the first 5 sec show 1st frame of the video_file.mp4
- the last 10 sec show the whole video_file.mp4
I guess it's possible with GES ... *can anyone advice how?*
The above scenario is simplified, i.e. keeping the pipeline in PAUSED state
for the 1st 5 sec is NOT a solution.
See attached what was already tried.
*Anyone has any examples of GESImageSource
<http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-editing-services/html/GESImageSource.html>
use?*
I'd appreciate any ideas, even the crazy ones :)
Smiles,
Andrei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150112/996c2270/attachment-0001.html>
-------------- next part --------------
// playground.c
#include <ges/ges.h>
int main (int argc, gchar ** argv)
{
GESPipeline *pipeline;
GESTimeline *timeline;
GESLayer *layer;
GMainLoop *mainloop;
gst_init (&argc, &argv);
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
if (!ges_timeline_add_layer (timeline, layer))
return -1;
/// ************ The interesting part starts here ******************** ///
gchar *video_file_uri = gst_filename_to_uri ("/path/to/video_file.mp4", NULL);
GESUriClipAsset *video_asset = ges_uri_clip_asset_request_sync (video_file_uri, NULL);
/// Trying to add a still video frame
GESUriClip *first_frame_clip = GES_URI_CLIP (ges_asset_extract (GES_ASSET(video_asset), NULL));
ges_uri_clip_set_is_image(first_frame_clip, TRUE); /// Had big hopes on this, but ges_layer_add_clip() resets it to FALSE
ges_timeline_element_set_start(GES_TIMELINE_ELEMENT(first_frame_clip), 0);
ges_timeline_element_set_inpoint(GES_TIMELINE_ELEMENT(first_frame_clip), 0);
ges_timeline_element_set_duration (GES_TIMELINE_ELEMENT(first_frame_clip), 5*GST_SECOND);
ges_clip_set_supported_formats(GES_CLIP(first_frame_clip), GES_TRACK_TYPE_VIDEO);
ges_layer_add_clip(layer, GES_CLIP(first_frame_clip)); /// resets "is-image" property of first_frame_clip to FALSE
/// Adding full video
ges_layer_add_asset(layer, GES_ASSET(video_asset), 5*GST_SECOND, 0, ges_uri_clip_asset_get_duration(video_asset), GES_TRACK_TYPE_VIDEO);
/// ****************************************************************** ///
ges_timeline_commit(timeline);
g_print("Timeline Time: %" GST_TIME_FORMAT "\r", GST_TIME_ARGS(ges_timeline_get_duration(timeline)));
pipeline = ges_pipeline_new ();
if (!ges_pipeline_set_timeline (pipeline, timeline))
return -1;
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
mainloop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (mainloop);
return 0;
}
More information about the gstreamer-devel
mailing list