Page 1 of 1

Rotate video via libvlc

Posted: 27 Jan 2021 13:32
by Lexani
Hello, everyone! I make a small videoplayer using libvlc. But I stucked in finding way to rotate video (for example 90 degrees clockwise). I found module vls_es.h with difinition of function making transformation with video. Also I found enum:
TRANSFORM_IDENTITY = ORIENT_NORMAL,
TRANSFORM_HFLIP = ORIENT_HFLIPPED,
TRANSFORM_VFLIP = ORIENT_VFLIPPED,
TRANSFORM_R180 = ORIENT_ROTATED_180,
TRANSFORM_R270 = ORIENT_ROTATED_270,
TRANSFORM_R90 = ORIENT_ROTATED_90,
TRANSFORM_TRANSPOSE = ORIENT_TRANSPOSED,
TRANSFORM_ANTI_TRANSPOSE = ORIENT_ANTI_TRANSPOSED
that matches with option in VLC player->Tools->Effects and Filters->VideoEffects->Geometry->Transform
Image
I used libvlc_media_player_t for media control.
How can I use video_format_t to send format to libvlc_media_player_t? Is it possible? Or maybe there is other way to make rotation?

Re: Rotate video via libvlc

Posted: 01 Feb 2021 03:21
by mfkl
See https://wiki.videolan.org/VLC_command-line_help

Code: Select all

Video transformation filter (transform) Rotate or flip the video --transform-type={90,180,270,hflip,vflip,transpose,antitranspose} Transform type
You could give this to `libvlc_new`

Re: Rotate video via libvlc

Posted: 05 Feb 2021 04:56
by obentul
I meet the same question , and i found a way to get and modify the parameter of transform filter , but it seems does not take effect . Steps ars as follows:

1) start vlc instance with transform fiter :

Code: Select all

const char *vlc_args[] = { "--video-filter=transform", "--transform-type=0", }; if (m_vlcInstance == Q_NULLPTR) { m_vlcInstance = libvlc_new(sizeof(vlc_args)/sizeof(vlc_args[0]), vlc_args); }
2) find the filter:

Code: Select all

vlc_object_t* p_filter2 = vlc_object_find_name((vlc_object_t*)m_mediaPlayer, "transform");
3) read , modify and re-read parameter :

Code: Select all

QString s_degree1 = var_GetString(p_filter2,"transform-type"); var_SetString(p_filter2, "transform-type","180"); QString s_degree2 = var_GetString(p_filter2, "transform-type");
As if new parameter is in the cache??? Anyone know how to make new parameter take effect???