SOLVED: GES specify Clip starting?

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

SOLVED: GES specify Clip starting?

killerrats
Administrator
This post was updated on .
I am adding many videos that are a continuous playing because of recording
cameras. I was trying to trim down the first clip in the timeline. the code
i use to add to the layer. I tell it to start at zero for the first clip. I
hope i explained that good?

anyone have a better way to doing this?

I tried ges_clip_split() but it says out of bounds.

for example: the clip is 00:00:09.000 long. I set the clipStart to be
00:00:02.000.

bool AddingTracksWithLayer(std::string filePath, GESTrackType mediatype,
guint64 startPos, GstClockTime LengthOfVideo, GESLayer* layer, GstClockTime
clipStart)
{
        GError* error = NULL;
        GESAsset* asst = NULL;
        GESClip* clip = NULL;
        gchar* source;

        source = g_strdup_printf("%s", filePath.c_str());
       
        asst = GES_ASSET(ges_uri_clip_asset_request_sync(source, &error));

        if (asst == NULL)
        {
                std::cout << "create uri failed " << (error != NULL) ? error->message :
"";
                g_clear_error(&error);
                return false;
        }
        clip = ges_layer_add_asset(layer
                , asst
                , startPos*GST_SECOND
                , 0
                , LengthOfVideo
                , mediatype);
        gst_object_unref(asst);
        if(clipStart != GST_CLOCK_TIME_NONE)
        {
                GESClip* newClip = ges_clip_split(clip, clipStart);
                ges_layer_remove_clip(layer, newClip);
                ges_layer_remove_clip(layer, clip);
                ges_layer_add_clip(layer, clip);
        }
        if (mediatype == GES_TRACK_TYPE_VIDEO)
                check_frame_positionner_size(clip,
std::stoi(std::to_string(this->aRenderWidth)),
std::stoi(std::to_string(this->aRenderHeight)));

        g_free(source);
       
        return true;
}



-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.16.2
------------------------------
Windows
Reply | Threaded
Open this post in threaded view
|

Re: GES specify Clip starting?

Thibault Saunier-4
Hello,

Looks like you either want to specify the inpoint when adding to the layer or use ges_timeline_element_trim[0] afterward.

Regards,

- Thibault


On Thu, Apr 30, 2020 at 7:35 PM killerrats <[hidden email]> wrote:
I am adding many videos that are a continuous playing because of recording
cameras. I was trying to trim down the first clip in the timeline. the code
i use to add to the layer. I tell it to start at zero for the first clip. I
hope i explained that good?

anyone have a better way to doing this?

I tried ges_clip_split() but it says out of bounds.

for example: the clip is 00:00:09.000 long. I set the clipStart to be
00:00:02.000.

bool AddingTracksWithLayer(std::string filePath, GESTrackType mediatype,
guint64 startPos, GstClockTime LengthOfVideo, GESLayer* layer, GstClockTime
clipStart)
{
        GError* error = NULL;
        GESAsset* asst = NULL;
        GESClip* clip = NULL;
        gchar* source;

        source = g_strdup_printf("%s", filePath.c_str());

        asst = GES_ASSET(ges_uri_clip_asset_request_sync(source, &error));

        if (asst == NULL)
        {
                std::cout << "create uri failed " << (error != NULL) ? error->message :
"";
                g_clear_error(&error);
                return false;
        }
        clip = ges_layer_add_asset(layer
                , asst
                , startPos*GST_SECOND
                , 0
                , LengthOfVideo
                , mediatype);
        gst_object_unref(asst);
        if(clipStart != GST_CLOCK_TIME_NONE)
        {
                GESClip* newClip = ges_clip_split(clip, clipStart);
                ges_layer_remove_clip(layer, newClip);
                ges_layer_remove_clip(layer, clip);
                ges_layer_add_clip(layer, clip);
        }
        if (mediatype == GES_TRACK_TYPE_VIDEO)
                check_frame_positionner_size(clip,
std::stoi(std::to_string(this->aRenderWidth)),
std::stoi(std::to_string(this->aRenderHeight)));

        g_free(source);

        return true;
}



-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: GES specify Clip starting?

killerrats
Administrator
I used as you said and worked perfectly. i put "clipStart" in replace with
the "0" i had in the assign to layer.

bool AddingTracksWithLayer(std::string filePath, GESTrackType mediatype,
guint64 startPos, GstClockTime LengthOfVideo, GESLayer* layer, GstClockTime
clipStart)
{
        GError* error = NULL;
        GESAsset* asst = NULL;
        GESClip* clip = NULL;
        gchar* source;

        source = g_strdup_printf("%s", filePath.c_str());
       
        asst = GES_ASSET(ges_uri_clip_asset_request_sync(source, &error));

        if (asst == NULL)
        {
                std::cout << "create uri failed " << (error != NULL) ?
error->message :
"";
                g_clear_error(&error);
                return false;
        }
        clip = ges_layer_add_asset(layer
                , asst
                , startPos*GST_SECOND
                , clipStart
                , LengthOfVideo
                , mediatype);
        gst_object_unref(asst);

        g_free(source);
       
        return true;
}



-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
------------------------------
Gstreamer 1.16.2
------------------------------
Windows