mpv-player / mpv

πŸŽ₯ Command line video player
https://mpv.io
Other
28.69k stars 2.93k forks source link

Facilitate 3D frame sequential/alternating frames for 3D output #2583

Open HLFH opened 8 years ago

HLFH commented 8 years ago

Hi,

@wm4

I hope I understood better and that it's not a useless issue here like the previous one.

I have a 3D Ready videoprojector named Vivitek Qumi Q7 that supports 3D with 120 Hz frame sequential/alternating frames output.

It seems that ffmpeg and its stereo3d filter don't support frame sequential/alternating frames for the output.

I guess that libav supports frame sequential output with avconv -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT as seen here.

It seems that the --video-stereo-mode mpv parameter does not offer 3D frame sequential output. Am I right? Or am I again completely wrong? I know that some mpv packages are linked to ffmpeg, some others to libav. For example, the Windows package is bundled with ffmpeg, so it can't work for that need.

Could you facilitate in some way the support of frame sequential/alternating frames as a 3D output in the mpv GUI?

(I also know that we can't use right now Plex Media Player for 3D output with frame sequential/alternating frames format)

Thanks in advance, HLFH

ghost commented 8 years ago

The framepack filter is apparently for packing frames, not unpacking them. And it's available in FFmpeg too.

If there are really fucked up files which encode both 3D sides with alternating frames, I'd like to see such a sample file.

In general, I wish this 3D nonsense would just die already. It's a stupid marketing fad meant to bait consumers into buying expensive hardware.

HLFH commented 8 years ago

Generally when we download 3D files on the Internet, it's in Half Side by Side (HSBS) or Half Over Under (HOU) format. In France, we have a website that criticizes new Blu-ray 3D movies. And I could say that Tsui Hark, the director of The Taking of Tiger Mountain (La Bataille de la Montagne du Tigre) is well-known to make 3D movies in the best available quality. I think that the 3D nonsense will be less a nonsense and be more mainstream with multi-view autostereoscopic 3D displays and 8K general availability towards 2020. I guess in the next five years, the Stereoscopic 3D W3C community group will seriously improve their research work and will make the 3D more universal. My videoprojector like most of 3D Ready videoprojectors support only 3D with frame sequential output.

So my story is:

I fully understand that you are angry with 3D. So to test it, you just have to download some HSBS or HOU 3D video content and convert it easily in frame sequential format. Could we improve frame sequential output support in mpv? Or you no longer want to spend time for 3D in your software?

richardpl commented 8 years ago

stereo3d does support alternating output, please test it and report back.

HLFH commented 8 years ago

@richardpl Where do you see it supports alternating output? For input, I need sbs2l, the side by side parallel with half width resolution (left eye left, right eye right) and for output, I need al, the alternating frames (left eye first, right eye second) but al is not supported for output: we have only anaglyph, mono, checkerboard, and interleaved outputs for ffmpeg stereo3D filter. Or am I wrong?? Or are you talking about libav??

richardpl commented 8 years ago

Read second line bellow out option description.

HLFH commented 8 years ago

Ok it's based on libavfilter library, the doc is not up-to-date. And ffmpeg supports alternating output.

richardpl commented 8 years ago

All input modes are also supported as output modes. Note that you need to use lavfi filter and not mpv wrapper as it does not recognise all modes.

ghost commented 8 years ago

and will make the 3D more universal.

Haha, no.

My videoprojector like most of 3D Ready videoprojectors support only 3D with frame sequential output.

I can't imagine how this works at all. There are too many problems with this. Note that field based output of interlaced video doesn't really work either for the same reason, except that field based output at least makes some sense wrt. timing.

It's somewhat likely that this sequential frame output exists only on the level of the hardware protocol, and that software will implement it differently. But I do not know.

I fully understand that you are angry with 3D.

Extremely so.

Could we improve frame sequential output support in mpv?

This already works with the filter that was mentioned. The question is whether it makes sense and the hardware picks it up this way.

richardpl commented 8 years ago

I would like to know if filter is working for you, because I do not have hardware to test it.

HLFH commented 8 years ago

xrandr --output HDMI1 --mode 1280x720 --rate 119.91 mpv '--vf=lavfi="stereo3d=sbsl:al"' Cosmic\ Journey.hsbs.mkv

With that, I'm testing one SBS image and I got one image, but I'm not sure if the 3D effects are really there. Furthermore, it's completely lagging, sadly. And the video seems to be cut on the right!

EDIT: Bino 1.6.1 works for this video, the 3D effects are there but it's lagging. When I'm using directly ffplay -vf stereo3d=sbsl:al Cosmic\ Journey.hsbs.mkv, it happens the same.

P.S.: I migrated from Windows 10 to Manjaro-i3. I guess that open source tools are not ready.

richardpl commented 8 years ago

I added direct path to sbsl-al,could you recompile ffmpeg and mpv and check again. Also could you provide that demo file?

HLFH commented 8 years ago

Yes I'll do that and come back to you.

Demo file: http://www.filefactory.com/file/xob1gckimt5/n/Cosmic_Journey.hsbs.mkv Direct link of demo file: http://fb.rdeb.io/d/VKW2WFNHL7EAK/Cosmic.Journey.hsbs.mkv

richardpl commented 8 years ago

Looks like mpv always auto insert own stereo3d wrapper. So I guess I need to change this wrapper too..

Add --video-stereo-mode=no to disable wrapper, but somehow now mpv drops too much frames.

richardpl commented 8 years ago

I fixed frame dropping, it was bug in implementation, so with latest ffmpeg and mpv, this should work:

mpv --video-stereo-mode=no ~/Videos/Cosmic.Journey.hsbs.mkv -vf "lavfi=[stereo3d=sbs2l:al]"

HLFH commented 8 years ago

@richardpl Thanks a lot!! I built the latest ffmpeg and mpv. But I'm getting a segmentation fault:

[hlfh@arch-client mpv]$ mpv --video-stereo-mode=no ~/TΓ©lΓ©chargements/Cosmic\ Journey.hsbs.mkv -vf "lavfi=[stereo3d=sbs2l:al]"
Playing: /home/hlfh/TΓ©lΓ©chargements/Cosmic Journey.hsbs.mkv
 (+) Video --vid=1 (*) 'Cosmic Journey-zman' (h264)
 (+) Audio --aid=1 --alang=eng (*) (dts)
     Audio --aid=2 --alang=ger (dts)
Opening video filter: [lavfi graph=stereo3d=sbs2l:al]
Erreur de segmentation (core dumped)

Do you have any idea of how to fix this?

[hlfh@arch-client mpv]$ ffmpeg -version
ffmpeg version N-77284-gf61d44b Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: 
libavutil      55. 11.100 / 55. 11.100
libavcodec     57. 17.100 / 57. 17.100
libavformat    57. 20.100 / 57. 20.100
libavdevice    57.  0.100 / 57.  0.100
libavfilter     6. 21.100 /  6. 21.100
libswscale      4.  0.100 /  4.  0.100
libswresample   2.  0.101 /  2.  0.101
[hlfh@arch-client mpv]$ mpv --version
mpv git-e798cf1 (C) 2000-2015 mpv/MPlayer/mplayer2 projects
 built on Wed Dec 16 22:52:47 CET 2015
ffmpeg library versions:
   libavutil       55.11.100 (runtime 54.31.100)
   libavcodec      57.17.100 (runtime 56.60.100)
   libavformat     57.20.100 (runtime 56.40.101)
   libswscale      4.0.100 (runtime 3.1.101)
   libavfilter     6.21.100 (runtime 5.40.101)
   libswresample   2.0.101 (runtime 1.2.101)
ffmpeg version: 2.8.3

Thanks!

ghost commented 8 years ago

Your build is completely broken. It's amazing it even gets so far and doesn't just crash on start.

richardpl commented 8 years ago

@HLFH your mpv somehow uses different FFmpeg library at runtime.

HLFH commented 8 years ago

@richardpl

Thanks a lot. The image is correctly centered but still, the issue is not fully solved: it shakes a lot!

osx-client:ZOUZOU root# mpv --video-stereo-mode=no Cosmic\ Journey.hsbs.mkv -vf "lavfi=[stereo3d=sbs2l:al]"
Playing: Cosmic Journey.hsbs.mkv
 (+) Video --vid=1 (*) 'Cosmic Journey-zman' (h264)
 (+) Audio --aid=1 --alang=eng (*) (dts)
     Audio --aid=2 --alang=ger (dts)
Opening video filter: [lavfi graph=stereo3d=sbs2l:al]
AO: [coreaudio] 48000Hz stereo 2ch floatp
VO: [opengl] 960x1080 => 1920x1080 yuv420p
AV: 00:09:50 / 00:22:02 (44%) A-V:  0.000

Exiting... (Quit)
osx-client:ZOUZOU root# brew info ffmpeg
ffmpeg: stable 3.0.2 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/3.0.2 (230 files, 47M) *
  Poured from bottle on 2016-05-13 at 10:37:45
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ffmpeg.rb
==> Dependencies
Build: pkg-config βœ”, texi2html ✘, yasm ✘
Recommended: x264 βœ”, lame βœ”, xvid βœ”
Optional: faac ✘, fontconfig βœ”, freetype βœ”, theora ✘, libvorbis ✘, libvpx ✘, rtmpdump ✘, opencore-amr ✘, libass βœ”, openjpeg ✘, snappy ✘, speex ✘, schroedinger ✘, fdk-aac ✘, opus ✘, frei0r ✘, libcaca ✘, libbluray ✘, libsoxr ✘, libvidstab ✘, x265 ✘, openssl βœ”, libssh ✘, webp ✘, zeromq ✘, libbs2b ✘, dcadec ✘, rubberband ✘, zimg ✘, openh264 ✘
==> Options
--with-dcadec
    Enable dcadec library
--with-faac
    Build with faac support
--with-fdk-aac
    Enable the Fraunhofer FDK AAC library
--with-ffplay
    Enable FFplay media player
--with-fontconfig
    Build with fontconfig support
--with-freetype
    Build with freetype support
--with-frei0r
    Build with frei0r support
--with-libass
    Enable ASS/SSA subtitle format
--with-libbluray
    Build with libbluray support
--with-libbs2b
    Build with libbs2b support
--with-libcaca
    Build with libcaca support
--with-libsoxr
    Enable the soxr resample library
--with-libssh
    Enable SFTP protocol via libssh
--with-libvidstab
    Enable vid.stab support for video stabilization
--with-libvorbis
    Build with libvorbis support
--with-libvpx
    Build with libvpx support
--with-opencore-amr
    Enable Opencore AMR NR/WB audio format
--with-openh264
    Enable OpenH264 library
--with-openjpeg
    Enable JPEG 2000 image format
--with-openssl
    Enable SSL support
--with-opus
    Build with opus support
--with-rtmpdump
    Enable RTMP protocol
--with-rubberband
    Enable rubberband library
--with-schroedinger
    Enable Dirac video format
--with-snappy
    Enable Snappy library
--with-speex
    Build with speex support
--with-theora
    Build with theora support
--with-tools
    Enable additional FFmpeg tools
--with-webp
    Enable using libwebp to encode WEBP images
--with-x265
    Enable x265 encoder
--with-zeromq
    Enable using libzeromq to receive commands sent through a libzeromq client
--with-zimg
    Enable z.lib zimg library
--without-lame
    Disable MP3 encoder
--without-qtkit
    Disable deprecated QuickTime framework
--without-x264
    Disable H.264 encoder
--without-xvid
    Disable Xvid MPEG-4 video encoder
--HEAD
    Install HEAD version
==> Caveats
The native FFmpeg AAC encoder has been stable since FFmpeg 3.0. If you
were using libvo-aacenc or libaacplus, both of which have been dropped in
FFmpeg 3.0, please consider switching to the native encoder (-c:a aac),
fdk-aac (-c:a libfdk_aac, ffmpeg needs to be installed with the
--with-fdk-aac option), or faac (-c:a libfaac, ffmpeg needs to be
installed with the --with-faac option).

See the announcement
https://ffmpeg.org/index.html#removing_external_aac_encoders for details,
and https://trac.ffmpeg.org/wiki/Encode/AAC on best practices of encoding
AAC with FFmpeg.
osx-client:ZOUZOU root# brew info mpv
mpv: stable 0.17.0 (bottled), HEAD
Free, open source, and cross-platform media player
https://mpv.io
/usr/local/Cellar/mpv/0.17.0 (206 files, 4.8M) *
  Poured from bottle on 2016-05-13 at 10:37:56
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mpv.rb
==> Dependencies
Build: pkg-config βœ”
Required: libass βœ”, ffmpeg βœ”
Recommended: jpeg βœ”, little-cms2 βœ”, lua βœ”, youtube-dl ✘
Optional: libcaca ✘, libdvdread ✘, libdvdnav ✘, libbluray ✘, libaacs ✘, vapoursynth ✘, uchardet βœ”
==> Options
--with-bundle
    Enable compilation of the .app bundle.
--with-libaacs
    Build with libaacs support
--with-libbluray
    Build with libbluray support
--with-libcaca
    Build with libcaca support
--with-libdvdnav
    Build with libdvdnav support
--with-libdvdread
    Build with libdvdread support
--with-shared
    Build libmpv shared library.
--with-uchardet
    Build with uchardet support
--with-vapoursynth
    Build with vapoursynth support
--with-x11
    Build with x11 support
--without-jpeg
    Build without jpeg support
--without-little-cms2
    Build without little-cms2 support
--without-lua
    Build without lua support
--without-youtube-dl
    Build without youtube-dl support
--HEAD
    Install HEAD version
==> Caveats
zsh completion has been installed to:
  /usr/local/share/zsh/site-functions

Hi! I moved to OS X 10.11.5. I installed ffmpeg & mpv via homebrew. I enabled 3D by scaling the resolution to 720p with 119.9Hz refresh rate within the settings preference of OS X. But still, when I'm using the command you gave me, I have one working 3D video excepted it has Parkinson: it shakes a lot! How to fix this effect? Thanks!

richardpl commented 8 years ago

That means your hardware doesn't support it.

HLFH commented 8 years ago

@richardpl Daum PotPlayer & Cyberlink PowerDVD Ultra are fully working on Windows for 3D output in frame sequential/alternating frames with the same Intel NUC D54250WYKH hardware + Vivitek Qumi Q7. So, it's just the software that does not fully support it.

richardpl commented 8 years ago

I dunno what may be problem. Perhaps pts should not be changed.

dominiquedodo commented 7 years ago

Hi,

Just to come back on the initial issue raised by @vm4.

The answer is YES. You can easily play 3D in frame sequential (page fliping or alternating) from any video SBS or top/bottom or even 2 separate files and many other format on Linux (Debian flavour). I am doing this since many years now (it never worked on Windows whatever the version).

You need DLP 3D ready projector with approviate active glasses (common to all DLP projector using the TI technology). You must setup your display to 120Hz using xrand to a compatible 3D ready mode (see your projector specifications). You must run either Bino (from the apt-get install bino) or Sview (just download and compile from given source code by following easy instructions). Both are working well (Sview can even emulate quadbuffer for NVIDIA in software select this option for frame sequential).

So far, mpv is not suporting 3D nor VLC so forget these for 3D. ffmpeg is useful with stereo3d filter for video format convertion only (ie from 3D TB to 3D SBS to play 3D on your mobile phone with VR for example).

HLFH commented 7 years ago

@dominiquedodo Thank you Dominique. I know Bino. I will check SView tonight.

@richardpl Do you have any thinking to say since you did not like the previous post?

richardpl commented 7 years ago

Bino does not to my knowledge instruct special instructions to handle alternating 3d.

dominiquedodo commented 7 years ago

I have no special comments about the previous post.

I just want to share here my relatively long experience with Bino and Sview in 3D. FYI I was already working with 3D on CRT display at 120Hz (with poor 640x480) with wired glasses on Nvidia card in early 2000! Furthermore later on (I think in 2004) the same setup was working with a basic 3LCD projector allowing 120Hz and it was possible to play opengl games in 3D (with 3m diagonal display). That was the fun despite poor resolution (640x480).

I am enjoying 3D movies for more than 3 years with bino and/or sview on 3D ready projector(s) and I just want to share this. I started to use sview because of some problems (bug) in the distribution library that bino is using (the problem appearing in October 2016). After a close look in the source code of bino I discovered that bino was correct and the fault was elsewhere. I used sview instead to let time to developpers to fix the issue in the library. Today this flaw is solved since months.

There are some differences between the two applications. Bino can handle multiple screens: for example display left view on one projector with a polarized filter and right view on another projector with cross polarized filter (the low cost full HD 3D is already possible with passive glasses you can print on 3D printer). Bino cannot handle 2 input files (left view and right view in 2 files). sview can do this but Sview cannot handle multiple screens.

Most of 3D ready projectors are "affordable" and only support alternating (frame sequential) mode such as Beng GP10 (or Acer K137i).

To use this mode in the Bino "output" drop box you must select left/right alternating (and in the settings of bino you must tick DLP sync option). Xorg.conf and the like must remain unchanged if you have only one display (which I advice for beginners). Of course the display must be set in 3D at 120Hz to enable DLP 3D. You will notice this when you set the mode as the display is reducing the brightness slightly.

For those interested the famous pulsar.c program can be slightly modified to run in full 3D with the 3D projectors (application such as quadbufferemu does not work for this as designed for Nvidia 3D).

rgaufman commented 5 years ago

+1