[FFmpeg-user] Stereoscopic hwaccel

JackDesBwa jackdesbwa at desbwa.org
Tue Sep 17 19:33:39 EEST 2019


Hi,

I do stereoscopic (3d) photography for a few years and I just start to
experiment on stereoscopic videos.
The filter_complex argument of ffmpeg allows me to do the editing I have in
mind more precisely and less painfully than I was able to do with regular
non-linear editors before.
Now that the basic editing tools seem to be right for my video projects, I
want to accelerate rendering with hardware, and here starts my question.

*How to have frame-packing information in h264 streams when generated with
hardware acceleration?*

I have both a UHD Graphics 620 and GeForce GTX 1050 GPUs on my machine.
The first (or at least a graphical subpart integrated to my processor) is
accessible with VAAPI while the second can use NVENC. Perhaps there are
others ways I am not aware of.

Removing the full chain of filter_complex to keep the simplest example,
computing using CPU would give:
ffmpeg -i aligned/l_01.mp4 -i aligned/r_01.mp4 -filter_complex
[0][1]framepack=sbs -c:v libx264 out_libx264.mp4
It takes 22s wall time and produces a 18Mio output.

Accelerating with vaapi:
ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi
-hwaccel_output_format vaapi -i aligned/l_01.mp4 -i aligned/r_01.mp4
-filter_complex '[0][1]framepack=sbs,format=nv12|vaapi,hwupload' -c:v
h264_vaapi -qp 22 -profile:v high out_vaapi.mp4
It takes 5.6s wall time and produces a 32Mio output.

Accelerating with nvenc:
ffmpeg -i aligned/l_01.mp4 -i aligned/r_01.mp4 -filter_complex
[0][1]framepack=sbs -c:v h264_nvenc -rc:v vbr_hq -qp:v 22 -profile:v high
out_nvenc.mp4
It takes 2.7s wall time and produces a 2.3Mio output.

The numbers are only for one short 240-frames
3604x1064-unfriendly-dimentions clip here.
The nvenc version is fast and create small file, but has very bad quality.
Perhaps I do not use the right parameters.
The vaapi version is quite fast too, but create a bigger file. Perhaps I
should tweak parameters here too.
Advices on parameters are welcomed, but the more import thing is the
following.

*The two accelerated versions do not add the SBS frame-packing information
in the stream*. The documentation of framepack filter says that it would
set proper metadata on supported codecs. Does it mean that I am stuck with
CPU codecs to get the proper output stream with stereo format information
in it?

JackDesBwa


More information about the ffmpeg-user mailing list