You are not logged in.

#1 2015-05-22 04:51:51

babyturtle
Member
Registered: 2015-05-22
Posts: 12

Video player that can layer videos?

Does mplayer (plugin?) or any other video player have the feature of being able to layer videos (with transparency) ontop of each other (just like editing software)? For realtime playback.

This would be very useful for 1 time animated logos and effects that you dont want to "burn" into the source video.

Offline

#2 2015-05-22 19:25:14

teckk
Member
Registered: 2013-02-21
Posts: 455

Re: Video player that can layer videos?

You're probably going to have to make a new video composite with ffmpeg.

http://stackoverflow.com/questions/1043 … ing-ffmpeg
http://superuser.com/questions/868204/o … ith-ffmpeg

I'll give you some examples:

This will put images on top of your video

Top left corner
ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv

Top right corner
ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv

Bottom left corner
ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" outputvideo.flv

Bottom right corner
ffmpeg -i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]" outputvideo.flv

Here are 3 examples for when I am overlaying subs onto a video
Overlay dvd_subs onto video (1st vid, 2nd audio, 2nd sub streams)

ffmpeg -i movie.vob -filter_complex "[0:0][0:4]overlay[0]" -map [0] -map 0:2 -c:a copy -c:v libx264 -b:v 2500k movie.avi
ffmpeg -i movie.vob -filter_complex "[0:v][0:s:1]overlay[v]" -map [v] -map 0:a:1 -c:a copy -c:v libx264 -b:v 2500k movie.avi

Overlay dvd_subs with cropping, video cropped=a, subs scaled=b, overlay (b over a)=c

ffmpeg -i video.vob -filter_complex "[0:0]crop=706:362:8:56[a];[0:4]scale=706:362[b];[a][b]overlay[c]" -map [c] -map 0:2 -c:a copy -c:v libx264 -b:v 2500k out.avi

Offline

#3 2015-05-23 05:53:42

babyturtle
Member
Registered: 2015-05-22
Posts: 12

Re: Video player that can layer videos?

Thanks for that...
I was hoping to do it with live, on the fly, videos... and just found a solution... it works with blender (the excellent 3d animation/video editing software)... I just layer the videos and view it at full quality in its preview window of the video editor.
The good thing about that is with blender you dont need to re-encode the videos, saving a ton of cpu.

Offline

#4 2015-05-31 16:35:06

DrZaius
Member
Registered: 2008-01-02
Posts: 193

Re: Video player that can layer videos?

Another method is with ffplay:

ffplay -f lavfi "movie=background.mkv[bg];movie=foreground.mkv,scale=180:-1[fg];[bg][fg]overlay=W-w-10:H-h-10"

See the overlay video filter documentation for more options and examples.

Offline

#5 2015-06-01 03:47:32

babyturtle
Member
Registered: 2015-05-22
Posts: 12

Re: Video player that can layer videos?

DrZaius wrote:

Another method is with ffplay:

ffplay -f lavfi "movie=background.mkv[bg];movie=foreground.mkv,scale=180:-1[fg];[bg][fg]overlay=W-w-10:H-h-10"

See the overlay video filter documentation for more options and examples.


Thanks for that tip... works.. but I think Im going to stick with the blender option (and if you do this type of work I recommend you do to...) because:
-its drag and drop simplicity (dont have to memorize 5 cli options and dont have to set height etc manually.)
-powerful control (eg setting complex/multiple times the overlaying is on/off, with fades and other effects)
-blender has many powerful blend/layering options (additive, multiply, alpha over, replace, alpha levels etc)... which ffmpeg doesnt seem to have.

Offline

#6 2015-08-25 00:34:59

gajjanag
Member
From: Cambridge, MA
Registered: 2015-05-10
Posts: 17
Website

Re: Video player that can layer videos?

@babyturtle: If you are interested in improving ffmpeg for this purpose, I have created a ticket for you on the bug tracker:
https://trac.ffmpeg.org/ticket/4801
Reopen if you wish to provide more details.


"Behind every theorem lies an inequality" - A N Kolmogorov

Offline

#7 2015-08-25 09:55:26

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: Video player that can layer videos?

EDIT: Doh, without burning into source... scratch this.. sorry.

A ffmpeg handler (vide handler script & more):

vhs -a bottom-left.mkv -p bl320 background.mp4

Note: The 320 is optional and indicates the width of the added PiP video.

vhs -a bottom-left.mkv -p bl -y background.mp4

To save some encoding time, and just copy the streams.

https://github.com/sri-arjuna/vhs

Last edited by esa (2015-08-25 10:07:53)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

Board footer

Powered by FluxBB