New Visualization plugin interest

Added by Jim Turner over 2 years ago

I wonder how hard it would be or if anyone else has considered adding a "Visulization plugin" that would allow Audacious to play the video part of some formats, ie. mp4 in the "visualization window"? I can play the audio part thru Audacious while the video window displays some visualization and I was thinking: "Why not play the video part there?!" A lazy way to do it maybe a plugin wrapper around / piggybacking off some existing video playing package like mplayer or VLC; or writing from scratch? Any thoughts / ideas?

Replies (4)

RE: New Visualization plugin interest - Added by John Lindgren over 2 years ago

I suggest devoting your time to improving one of the existing open-source video players instead. Starting from scratch (relatively speaking) to add video playback to Audacious would be a major undertaking, and with no reflection on your own development skills, I doubt that you could produce a result anywhere as good as the more mature projects that are already around.

RE: New Visualization plugin interest - Added by Jim Turner over 2 years ago

My idea does not involve trying to make an Audacious plugin that could compete with the best video players (when I want serious video action I use VLC), nor remake Audacious (and my personal, already very hacked "Fauxdacious" version!) into a general-purpose video player. However I love Audacious and just initially want a simple, quick, & dirty way to see the video part of some videos while using Audacious w/it's beautiful Winamp skin and great audio capabilities (and keep my programming skills sharp in retirement)! My evil plot now is hacking on the ffaudio plugin to display the video from mp4 and avi files which it processes. I've already hacked up a very quick & dirty option which pipes to ffplay (no video controls except stop and start, but you CAN view the video in a popup window while the audio plays!), and Audacious handling the audio and it seems to work (for me)! This is strictly a spare-time-wasting hobby, but my next idea is looking at ffplay.c and seeing if it's possible to merge in some of that code to handle the video stream. But hey, Linux started this way! The biggest roadblock I've run into so far with the initial pipe idea is that it seems to be impossible to capture and "tee" ALL the input data to stdout or another file whilst processing, and ffplay does not talk thru dbus, for example avformat_open_input READS stuff on open and discards it such that you can't get the full data buffer read to pass on to the pipe (and obviously, this method barrs seeking, (though ffplay doesn't seem to have any trouble handling stdin). I hacked around that for one type of video, but with avi's I could NOT pipe out the full input to ffplay. However, I am looking for ideas, suggestions, collaboration from the community and info or anyone else who's interested and/or attempted to do this in Audacious! Typically when I start something like this I usually eventually find others (with more knowledge than me) who's either done most of the heavy lifting already or given up and listed the reasons why it can't be done.

So far so good!: - Added by Jim Turner over 2 years ago

So far so GOOD! (SEE PHOTO) I got this seeming to work pretty well w/only changes to ffaudio plugin.
I've got mp4's, avi, swf, and flv's working for the most part (for the one's I've tried), including avi and flv also working thru STDIN!
Start, stop, and pause seem to be working fairly well too. I added 2 options (currently under Filewriter section - didn't have time while
creating to try creating a new "ffaudio section"), (but I pbly should!):

videoplayer_path=/usr/bin/ffplay -x 640 -y 360 -sync video -af anullsink -autoexit -window_title Fauxdacious -i -

These specify whether or not you want videos played (or only normal audio processing) and what external player
(and options) you want to pipe the raw input to. The above command nulls out the audio part so that it's only heard thru Audacious!

One goal was to be able to stream youtube (via youtube-dl) videos thru, which now works w/an extra step
(see ffmpeg fragment below that converts from mp4 to avi - ideally shouldn't be needed) of converting from mp4 to avi instream.
This is the next wall I've run into - can't stream mp4's (yet) thru stdin. Research seems to say this is impossible
since mp4's put their file info at the END of the file requiring seeks, BUT "ffplay" (and "ffmpeg" below) CAN
play 'em coming in thru a stdin pipe?!?! (I haven't figured how how though, so need more light on that!)

Current command for youtube:

/usr/local/bin/youtube-dl --youtube-skip-dash-manifest -f mp4 --no-part $1 -o - 2>/dev/null | /usr/bin/ffmpeg  -i - -acodec copy -vcodec copy -f avi 2>/dev/null - | /usr/local/bin/fauxdacious -Dc stdin://-.avi

While piping is fine for me in most cases, since most of my videos are streamed thru the web, Ideally, I (or someone) should create code,
similar to the video part of ffplay to play the video within Audacious instead of piping, this should then allow seeking
(for non STDIN-streamed input) controlled by the time-slider in Audacious and keep the audio and video synced!

Stay tuned!

FauxdaciousStreamingVideo.png (220 KB) FauxdaciousStreamingVideo.png Desktop photo of Audacious playing Video stream!

I've just written a patched and working ffaudio plugin that PLAYS VIDEO! - Added by Jim Turner over 2 years ago

I now have a patched ffaudio plugin (v. 3.6) that actually optionally plays the video stream from files and streams processed by ffaudio (mp4, avi, flv, swf, etc.).
It will also stream mp4, avi, and flv from stdin! (You have to add avi and flv extensions to plugin-registry though).
The user specifies an option in the Audacious config file (play_video=TRUE) that will cause Audacious to pop up a separate window to play the video in sync with the audio.

The user can resize and close the video window. Pause and stop work as expected.
Seeking works somewhat - pretty well if paused before seeking, intermittantly (sometimes just freezes and doesn't come back) if not paused first (not sure why).
Video image quality is excellent, but playback is very slightly jerky but very tolerable (to me), but stays pretty much in sync w/audio.
The choppiness appears to be related to having to process the audio packets within the same thread.
Video config options are all now under [ffaudio] section. I've included the source file ( attached, along with a diff (against Audacious v3.6).
I also had to modify the ffaudio Makefile to add the SDL library (diff):

>diff Makefile
< LIBS += ${FFMPEG_LIBS} -laudtag
> LIBS += ${GTK_LIBS} ${FFMPEG_LIBS} -lswscale -lavcodec -laudtag -lX11 -lSDL -lz -lm 

The file in the root directory also had to be modified for the same reason (diff):
< OUTPUT_PLUGINS ?=  oss4 alsa filewriter
> OUTPUT_PLUGINS ?=  pulse_audio oss4 alsa sdlout filewriter
< SDL_LIBS ?= 
> SDL_LIBS ?= -lSDL 

new config options:

video_windowtitle=Audacious Video

I am able to stream from youtube using the following command (in a script file):

/usr/local/bin/youtube-dl --youtube-skip-dash-manifest -f mp4 --no-part $1 -o - 2>/dev/null | fauxdacious stdin://-.mp4