jeudi 8 avril 2021

GStreamer videoflip has no affect

I have a gstreamer setup where I need to quickly switch between different sources to avoid buffering. Now I want to rotate the video in this pipeline. I added the videoflip element in the pipeline I am assembling:

void createSourcePipeline(char* filepath){
    gchar name[128];
    GstElement *src_pipe = gst_pipeline_new (name);
    
    GstElement *filesource =  gst_element_factory_make ("filesrc",    "filesource");
    GstElement *srcqueue =    gst_element_factory_make ("queue",      "srcqueue");
    GstElement *demux =       gst_element_factory_make ("qtdemux",    "demux"); // maybe replace with "aiurdemux"
    GstElement *vflip =       gst_element_factory_make ("videoflip", "vflip");
    GstElement *valve =       gst_element_factory_make ("valve",    "valve");
    GstElement *app_sink =    gst_element_factory_make ("appsink",   "appsink0");
    GstElement *decoder =   nullptr;
    
    if(m_bGstFSL) {
        decoder = gst_element_factory_make ("vpudec",     "decoder");
        g_object_set(decoder,  "frame-drop",m_decoder_frame_drop,  NULL);
        g_object_set(decoder,  "use-vpu-memory",m_decoder_use_vpu_mem,  NULL);
        g_object_set(decoder,  "frame-plus",m_decoder_frame_plus,  NULL);
        g_object_set(decoder,  "low-latency",m_decoder_low_latency,  NULL);
        g_object_set(decoder,  "output-format",2,  NULL);
    } else {
        decoder =     gst_element_factory_make ("imxvpudec",     "decoder");
        g_object_set(decoder,  "num-additional-framebuffers",m_decoder_frame_plus,  NULL);
    }
    
    g_object_set(vflip, "video-direction", 2, NULL);
    gst_bin_add_many (GST_BIN (src_pipe), filesource, srcqueue,demux, vflip,valve,decoder ,app_sink,NULL);
    
    g_object_set(srcqueue, "max-size-buffers",20,NULL);
    
    g_object_set(filesource,"location", filePath,NULL);
    
    if(!gst_element_link (filesource,srcqueue))   {
        msgWarn("createSourcePipeline: gst_element_link filesource,srcqueue failed!");
    }
    if(!gst_element_link (srcqueue, demux))  {
        msgWarn("createSourcePipeline: gst_element_link srcqueue, demux failed!");
    }
    if(!gst_element_link(demux, vflip)){
        msgWarn("createSourcePipeline: gst_element_link demux, vflip failed!");
    }
}

This does not throw any errors or shows the warning message for the linking but the video is not rotated by 180°. I left out the appsink I am setting up, because I pressume that this is the relevant part?

I have the videoflip element installed:

gst-inspect-1.0 videoflip
Factory Details:
  Rank                     none (0)
  Long-name                Video flipper
  Klass                    Filter/Effect/Video
  Description              Flips and rotates video
  Author                   David Schleef <ds@schleef.org>

Plugin Details:
  Name                     videofilter
  Description              Video filters plugin
  Filename                 /usr/lib/gstreamer-1.0/libgstvideofilter.so
  Version                  1.14.4
  License                  LGPL
  Source module            gst-plugins-good
  Source release date      2018-10-02
  Binary package           GStreamer Good Plug-ins source release
  Origin URL               Unknown package origin

Aucun commentaire:

Enregistrer un commentaire