Project

General

Profile

New Video-playing Plugin!

Added by Jim Turner over 8 years ago

I have hacked up ffaudio (ffaudio-core.cc), adding SDL to the Makefile and a new [ffaudio] section to the config file to enable an optional VIDEO popup window for ffaudio-supported formats that include video streams, to play the video portion in sync with the audio and controlled by the Audacious controls (start, stop, pause, and seek slider, etc.) It seems to work well and pretty smooth (IMHO) with most video files and streams (after I added some queueing tricks). Though not intended to replace full-featured video-players, it fully achieves my goal of a simple "visualization" window that displays the video! I built against my v. 3.6.0 version of Audacious, but since I couldn't build the current GIT version due to conflicts with my development environment, I checked the differences between my original ffaudio-core.cc and the latest GIT version finding only a single line (line 377) difference (I added the new tta extension at the bottom to mine). See the comment in my new version containing "BUILD NOTE" to tweak for current version of Audacious! I also was not able to test the newer Audacious "stdin" feature, since I'm not sure if it returns the filename as "-" or "file://-", etc. (Mine looks for "-" or "stdin://-.<ext>" to handle streaming via stdin, since my 3.6 development version predates that and is hacked my own way to do stdin - and DOES work for this) - see line 502 for possible tweaking). Please feel free to try out and comment!

config file additions:

[ffaudio]

video_windowtitle=Audacious Video
#video_qsize=16
#video_sws_scale=4
#video_xsize=800
#video_ysize=600

Ideally, this SHOULD also work with streaming "youtube-dl" videos in real-time (no seeking, since live) using a script like (I have a very similar one working):

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

Enjoy!

Jim Turner

ffaudio-core.cc (35.2 KB) ffaudio-core.cc Source
ffaudio-core.cc.diff (28.9 KB) ffaudio-core.cc.diff Diff
Makefile.ffaudio.diff (330 Bytes) Makefile.ffaudio.diff ffaudio/Makefile change to add SDL library
FauxdaciousStreamingVideo.png (220 KB) FauxdaciousStreamingVideo.png Screenshot

Replies (2)

RE: New Video-playing Plugin! - Added by Jim Turner over 8 years ago

Oops, left off config option:

play_video=TRUE

If not specified or set to FALSE, no video window is created or displayed and Audacious works as normal. The other config options are all optional. One can optionally specify xsize and/or ysize. If only one specified, the other is calculated by the video's aspect ratio. If neither specified, the video's size is used.
See source-code comments for tweaking the qsize, the scale defaults to 4 (SWS_BICUBIC)

ffaudio plugin patch with video play option! - Added by Jim Turner over 8 years ago

After a few more days to test and play around with this I've found and fixed several issues:

NOTE: Discovered that streaming from stdin does not work (for me and my version of Audacious) if the "MPRIS2 Server"
plugin is enabled since it reads some of the file and stdin can not be rewound! (I don't use this anyway)

1) Fixed random segfaults when adding items to the Playlist when a file/stream is playing that uses the (new version) ffaudio plugin. Problem involved not properly closing down the input file & codecs, and having a couple of new static variables that were getting overwritten by the probing functions invoking another instance of the ffaudio plugin when a file was being added. Eliminated these static variables and made them local / parameterized / reinitialized, etc.

2) Added config options to save the popup video window's geometry (like other Audacious windows), so that it doesn't pop up in random places on the screen when playback advances to another "song" with video (I found this random placement to be somewhat annoying).

3) More optimizations / adjustments to the queueing / video playing algorithm.

4) Minor adjustments to optimize the window resizing.

5) Other minor code and comment cleanups / optimizations.

The config options are now (shown with defaults):

play_video=TRUE     #Set to true if you want popup video visualization window, false for normal Audacious operation.
video_qsize=16      #Useful values: 8-56 or so.  Not enough=jittery video, too many=audio/video noticably out of sync.
video_sws_scale=16  #SWS_BICUBIC - see Libswscale before changing this value, default should work fine for most.
video_window_h=0    #THESE 4 SET BY AUDACIOUS TO SAVE THE VIDEO WINDOW GEOMETRY.
video_window_w=0
video_window_x=0
video_window_y=0
video_windowtitle=Audacious    #Text you want shown in the window's title bar. (default: nothing)
video_xmove=0       #-1, 0, 1, or 2 (see code comments) - Controls how/where window is placed on screen.
video_xsize=0       #-1, 0, or fixed width (see code comments) -1=restore to saved width, use aspect to recalc. height
video_ysize=0       #-1, 0, or fixed height                    ", 0=use video's height
                    #Best to specify only xsize OR ysize as non-zero and let Audacious calculate to preserve aspect.
video_resizedelay=0 #millisecs to delay after resizing video window, experiment if you have issues.
    (1-2/2)