Search code examples
c#.net-coregstreamergstreamer-1.0

Gstreamer-sharp: can't replicate working pipeline. Convert mp4 to jpeg


Given working cmd pipeline: gst-launch-1.0 filesrc location="d:\test.mp4" ! decodebin ! jpegenc ! multifilesink location="d:\test_img\img_%06.jpg"

I'm trying to replicate this in C# code. First approach use Parse.Launch, namely

var pl = Parse.Launch("filesrc location=\"d:\\test.mp4" ! decodebin ! jpegenc !  multifilesink location="d:\test_img\\img_%06.jpg\"");

throws following error:

0:00:00.228884400 6180 000001136A79A360 WARN basesrc gstbasesrc.c:3693:gst_base_src_start_complete: pad not activated yet

0:00:00.234893700 6180 000001136A8AD4C0 WARN qtdemux qtdemux_types.c:267:qtdemux_type_get: unknown QuickTime node type gsst

0:00:00.235624500 6180 000001136A8AD4C0 WARN qtdemux qtdemux_types.c:267:qtdemux_type_get: unknown QuickTime node type gstd

0:00:00.236899200 6180 000001136A8AD4C0 WARN qtdemux qtdemux.c:3245:qtdemux_parse_trex: failed to find fragment defaults for stream 1

0:00:00.237568000 6180 000001136A8AD4C0 WARN qtdemux qtdemux.c:3245:qtdemux_parse_trex: failed to find fragment defaults for stream 2

0:00:00.280679200 6180 000001136A8AD4C0 WARN d3d11device gstd3d11device.cpp:1271:gst_d3d11_device_get_video_device_handle: D3D11 call failed: 0x80004002, Not supported interface

Second approach:

  // Build the pipeline
    var filesrc = ElementFactory.Make("filesrc", "source");
    filesrc["location"] = "d:\\test.mp4";

    var dec = ElementFactory.Make("decodebin", "decodebin");

    var jpegenc = ElementFactory.Make("jpegenc", "jpegenc");

    var multiFileSink = ElementFactory.Make("multifilesink", "multifilesink");
    //multiFileSink["min-keyframe-distance"] = 100;
    multiFileSink["location"] =      "D:\\test_img\\img_%d.jpg";


    var pipeline = new Pipeline("test");

    pipeline.Add(filesrc, dec, jpegenc, multiFileSink);

    if (!filesrc.Link(dec))
    {
        Console.WriteLine("Could not link pipeline elements");
        throw new Exception();
    }

  
    if (!dec.Link(jpegenc))
    {
        Console.WriteLine("Problem to link dec and jpeg");
        throw new Exception();
    }

    if (!jpegenc.Link(multiFileSink))
    {
        Console.WriteLine("Problem to link jpeg and multi");
         throw new Exception(); 
    }

...

I have smth like:

0:00:01.106256400 24088 0000019C81B84E80 WARN basesrc gstbasesrc.c:3132:gst_base_src_loop: error: Internal data stream error.

0:00:01.106834200 24088 0000019C81B84E80 WARN basesrc gstbasesrc.c:3132:gst_base_src_loop: error: streaming stopped, reason not-linked (-1)

What I'm doing wrong? What I'm missing?

Thanks in advance.


Solution

  • It seems there is no issue. Everything works as expected. These warn messages is not that critical.