Filter plugin for VLC (http://videolan.org) to gain access to external filters via pipe.
This plugin adds a new video filter module to VLC (y4mpipe) that can be used to pass frames to/from external command prior to being displayed by VLC. It opens up the possibilities for more filtering options such as Vapoursynth scripts and FFmpeg filters. The filter can also be used in "echo" or one-way mode where it doesn't filter the pictures, only sends them to the output process.
The way it works is by writing frames to the process stdin, and reading frames back from the process stdout. The frames are read/written out as uncompressed YUV4MPEG2 format (Y4M).
At this time, the filter input/output must have the same chroma/color space and dimensions. The frame rate can be changed, however it must be an integer ratio and cannot be decreased. For example, the frame rate can be doubled or tripled but cannot be halfed or go from 24ps to 30 fps.
This is still a work in progress and compiles against VLC 3.0 which is currently unstable but maybe finished soon.
- Linux or other UNIX flavor
- VLC 3.x with chain-static patch
- Glib 2.x
- Compile VLC from source with chain-static patch (see below).
- Modify the Makefile PREFIX as needed (defaults /usr/local)
- Type make; sudo make install (default /usr/local/vlc/plugins/video_filter/)
vlc --video-filter y4mpipe --y4m-cmd cat file.mp4
vlc --video-filter y4mpipe --y4m-cmd "ffplay -autoexit -" --y4m-echo file.mp4
vlc --video-filter y4mpipe --y4m-cmd "ffmpeg -i - -vf swapuv -f yuv4mpegpipe -" file.mp4
- Sample script provided in test/mcfi.vpy
- Requires my fork of vsrawsource for pipe support (https://github.com/walisser/vsrawsource)
vlc --video-filter y4mpipe --y4m-cmd "vspipe --y4m mcfi.vpy -" file.mp4
This patch inserts the filter into the static filter chain which is currently reserved for deinterlace and postproc filters. The static chain allows filters to make PTS changes and supports changing the frame rate.
This is a temporary measure until this function can be added to VLC in a more general manner, for example via the module descriptor or a command line switch.
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index cbc8dc0..5b9c46f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -687,7 +687,8 @@ static void ThreadChangeFilters(vout_thread_t *vout,
e->name = name;
e->cfg = cfg;
if (!strcmp(e->name, "deinterlace") ||
- !strcmp(e->name, "postproc")) {
+ !strcmp(e->name, "postproc") ||
+ !strcmp(e->name, "y4mpipe")) {
vlc_array_append(&array_static, e);
} else {
vlc_array_append(&array_interactive, e);