Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to support videos? #5

Open
tadly opened this issue Aug 2, 2020 · 3 comments
Open

Is there any way to support videos? #5

tadly opened this issue Aug 2, 2020 · 3 comments

Comments

@tadly
Copy link

tadly commented Aug 2, 2020

Curious if this could be done as converting even just a 30fps video loop to bmps is a bit much given the amount of data you end up with

Video Loop: 30 sec., 30fps
mp4: 3,7MB
bpms: 5,58 GB

While many are probably fine with pixel style low fps loops, I personally can't stand it ':D

@glouw
Copy link
Owner

glouw commented Aug 2, 2020

Yup, its pretty insane. Paperview is meant for running small 15 frame gifs that expand nicely into bitmaps since SDL2 has a built in bitmap loader. This keeps the code portable and about 100 lines at its core which is ideal for gathering upvotes on reddit ;D. People love small compact codes that do fun things.

But anyway, the gist to streaming whole mp4s to the wallpaper is to write a video player with SDL2, using the conventional setup where you render to the usual window. A tutorial is here:

http://dranger.com/ffmpeg/

The final step is to incorporate X11 by swapping out the window creation function, SDL_CreateWindow(), and hook it up to the X11 root display:

#include <SDL2/SDL.h>
#include <X11/Xlib.h>
...
Display* x11d = XOpenDisplay(NULL);
Window x11w = RootWindow(self.x11d, DefaultScreen(x11d));
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindowFrom((void*) x11w);

Thus, two libraries are relied on, SDL2, and X11 Xlib, and the final compile, assuming you put everything in main.c, is:

gcc main.c -lSDL2 -lX11 -o tadlyview

If you can get it right I am sure you will gather a good following!

@Theldus
Copy link

Theldus commented Dec 13, 2021

Hi,
Thanks to @glouw's tip, I managed to follow the basic idea of the Dranger's tutorial (although it's out of date, again) and created a video player (no audio) with libav and SDL2, which uses the X11 root window, like paperview. If you want to take a look: https://github.com/Theldus/anipaper

@glouw
Copy link
Owner

glouw commented Dec 17, 2021

That's awesome, nice work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants