ffmpeg mit quicksync

  • Hallo,

    Gibt es hier jemand, der mir für Linux ein aktuelles 64bit ffmpeg mit quicksync für Linux (Linux Mint 18.1 / Ubuntu 16.04 LTS) kompilieren würde ?

    Ich schaff das, auch mangels Englischkenntnissen und komplizierten Abhängigkeiten, einfach nicht. Und nirgends scheint ein fertiges (kompiliertes) ffmpeg downloadbar zu sein.
    Das würde mir sehr helfen.

    Für Windows scheint es ja was zu geben: https://ffmpeg.zeranoe.com/builds/

    Gruß ggrub

  • Ich gehöre nicht zu den regelmäßigen Linux-Nutzern; aber ich vermute, dass man die MABS als Basis für eine Compilierung unter einem echten Linux verwenden könnte, wenn man die Differenzen zu einer MSYS-Umgebung kennt und ersetzen kann. Haupt-Unterschied wird dann sicherlich sein, ein ELF-Binärformat statt einer PE zu erzeugen. Aber das wird sicherlich auch bedeuten, einen anderen Satz an plattformspezifischen Bibliotheken einzubinden, was den Zugriff auf Geräte statt auf Dateien angeht.

  • Es gelingt mir einfach nicht komplett von Windows wegzukommen !!!

    Es war schon der blanke Horror ein aktuelles "qemu" aus dem git zu kompilieren. ffmpeg ist noch mal eine andere Hausnummer. Ich hatte die Hoffnung das sich hier ein paar Linux-Spezis tummeln die mir helfen könnten. Die größte Hürde sind ja diese ***eiß Abhängigkeiten, die wiederum andere Abhängigkeiten voraussetzen.
    Damit kann man sich das eigene Linux-Sys komplett zerschießen weil neuere Versionen NICHT kompatibel sind mit ältere Versionen und umgekehrt.

    Klar hab ich eine Anleitung gefunden, natürlich in Fachchinesisch-Englisch: https://gist.github.com/Brainiarc7/dd9…1b3a0754e352f53

    Schön für Insider, Mist für Otto-Normal-User ! Es ist einfach frustrierend.


  • Hallo,

    Mittlerweile bin auf Arch (xfce) umgstiegen. Aus dem AUR kann man ffmpeg 4 (ffmpeg_qsv) installieren. Klappt auch soweit, leider aber nicht mit avi-Input.

    Hier mal das AVI Info

    Code
    ffmpeg -i test_01.aviGuessed Channel Layout for Input Stream #0.1 : stereoInput #0, avi, from 'test_01.avi':  Duration: 00:02:49.48, start: 0.000000, bitrate: 43494 kb/s    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 41181 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc    Stream #0:1: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s

    Und so sieht das halt aus wenn ich versuche das AVI zu encoden:

    Code
    ffmpeg -hwaccel qsv -c:v h264_qsv -i test_01.avi -c:v h264_qsv -preset veryslow -profile:v high -level:v 41 -g 50 -aspect 16/9 -look_ahead 1 -look_ahead_depth 30 -b:v 8000000 -y out.mp4[user@user-pc a5_Lwork]$ ffmpeg -hwaccel qsv -c:v h264_qsv -i test_01.avi -c:v h264_qsv -preset veryslow -profile:v high -level:v 41 -g 50 -aspect 16/9 -look_ahead 1 -look_ahead_depth 30 -b:v 8000000 -y out.mp4ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers  built with gcc 8.1.0 (GCC)  configuration: --prefix=/usr --extra-libs=-lpthread --disable-debug --disable-rpath --enable-gpl --enable-version3 --enable-nonfree --enable-shared --disable-static --enable-gray --enable-avisynth --enable-avresample --enable-alsa --enable-fontconfig --enable-gmp --enable-gnutls --enable-iconv --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-librsvg --enable-librtmp --enable-libsmbclient --enable-libtheora --disable-libtls --enable-libtwolame --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-lzma --enable-libdrm --enable-xlib --enable-zlib --enable-omx --enable-openal --enable-opencl --enable-opengl --disable-openssl --enable-libfdk_aac --enable-libmfx --enable-vaapi --enable-vdpau  libavutil      56. 14.100 / 56. 14.100  libavcodec     58. 18.100 / 58. 18.100  libavformat    58. 12.100 / 58. 12.100  libavdevice    58.  3.100 / 58.  3.100  libavfilter     7. 16.100 /  7. 16.100  libavresample   4.  0.  0 /  4.  0.  0  libswscale      5.  1.100 /  5.  1.100  libswresample   3.  1.100 /  3.  1.100  libpostproc    55.  1.100 / 55.  1.100[h264 @ 0x56265303c900] missing picture in access unit with size 266406[h264 @ 0x56265303c900] no frame![h264 @ 0x56265303c900] missing picture in access unit with size 266758[h264 @ 0x56265303c900] no frame![h264 @ 0x56265303c900] missing picture in access unit with size 267401[h264 @ 0x56265303c900] no frame![h264 @ 0x56265303c900] missing picture in access unit with size 268443[h264 @ 0x56265303c900] no frame![h264 @ 0x56265303c900] missing picture in access unit with size 178480[h264 @ 0x56265303c900] no frame![h264 @ 0x56265303c900] missing picture in access unit with size 190123usw. usw. usw.[h264 @ 0x56265303c900] missing picture in access unit with size 183358[h264 @ 0x56265303c900] no frame![avi @ 0x56265303af80] decoding for stream 0 failed[avi @ 0x56265303af80] Could not find codec parameters for stream 0 (Video: h264 (MJPG / 0x47504A4D), none, 1920x1080, 41181 kb/s): unspecified pixel formatConsider increasing the value for the 'analyzeduration' and 'probesize' optionsGuessed Channel Layout for Input Stream #0.1 : stereo

    Hat dazu jemand eine Info für mich ?

    Verwendet man z.B. libx264 zum Encoden funktioniert es.

    Code
    ffmpeg -i test_01.avi -c:v libx264 -b:v 8000000 -y out.mp4

    Gruß ggrub

  • Code
    ffmpeg -hwaccel qsv -c:v h264_qsv -i test_01.avi -c:v h264_qsv -preset veryslow -profile:v high -level:v 41 -g 50 -aspect 16/9 -look_ahead 1 -look_ahead_depth 30 -b:v 8000000 -y out.mp4


    Vermutung, das '-c:v h264_qsv' vor dem Input könnte das Problem sein,.. nach dem Input rufst Du es nochmal auf.
    Da es kein Pramater für den Input würde ich es nur hinter den Input packen.

    Cu Selur

  • Ich hab schon so einiges versucht, das natürlich auch ... es will einfach nicht funktionieren.

  • So jetzt sieht man zumindest andere Probleme :)
    -> Füge '-pix_fmt yuv420p' (vor dem Output) hinzu, damit klar ist was für ein Pixelformat verwendet werden soll. (aktuell ist yuvj422p das Format des Inputs gewählt was qsv nicht unterstützt)
    + sicher, dass die ganzen anderen Optionen von QSV unterstützt werden? Würde die sonst erst mal raushauen und nach und nach reinhauen.

  • Ich würde nicht QSV verwenden. Nimm lieber die Anpassung von QSV an Linux. Die nennt sich VAAPI.
    Für QSV brauchst du einen gepatchten Kernel und angepasste System-Bibliotheken.

    Zitat

    Note that the kernel patches and modified system libraries are all required. It is recommended not to install this on any machine also used for other purposes, as it does not use normal distribution mechanisms and may break / be broken by other packages unexpectedly.


    Übersicht über alle hwaccel von ffmpeg: https://trac.ffmpeg.org/wiki/HWAccelIntro
    Der VAAPI Support von ffmpeg stammt von libav, deshalb findest du die genaueren Angaben in ihrem Wiki
    https://wiki.libav.org/Hardware/vaapi

  • Ok, ich hab mal kurz VAAPI getestet. Funktioniert erst mal.

    Der speed=2.95x ist meilenweit von qsv entfernt. Wenn ich diese Datei in Hybrid (Windows 7) lade und mit qsvencc (qsv) encode geht da die Post ab.
    Irgendwo klemmt es noch.

  • Und das ist der Grund: VAAPI-basierte Encoder können nur Eingaben aus VAAPI-Oberflächen annehmen.

    Zitat


    Surface Formats
    The hardware codecs used by VAAPI are not able to access frame data in arbitrary memory. Therefore, all frame data needs to be uploaded to hardware surfaces connected to the appropriate device before being used. All VAAPI hardware surfaces in ffmpeg are represented by the vaapi pixfmt.


    Und der Farbraum ist scheinbar auf 4:2:0 festgetackert. Was für ein Nachteil !

    Um also einen Stream/Datei im yuvj422p (test_01.avi) Farbraum verarbeiten zu können, muß eine hwupload-Instanz vorangestellt werden um einen normalen Frame in einen Frame im Vaapi-Format zu konvertieren. Und DAS kostet gewaltig Performance.

    Code
    ffmpeg -vaapi_device /dev/dri/renderD128 -i test_01.avi -vf 'format=yuvj422p,hwupload' -c:v h264_vaapi ... out.mp4


    Da kriecht hier das Encoding mit max. 3x durch die Gegend. Die Hardwarefilter können auch nicht angewendet werden.

    Ist allerdings der Stream/Datei im yuv(j)420p Farbraum ...

    Code
    ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i test_01_420.avi -c:v h264_vaapi ... output.mp4


    ... ja dann geht die Post ab mit 10 fachen Speed. Aber was nützt das demjenigen der halt 442-avi's hat.

    Umwandeln nach yuvj420p oder yuv420p und nach ffmpeg pipen. Keine Ahnung ob die VAAPI-Oberfläche den Input dann verarbeiten kann.

    Code
    vainfo: Supported profile and entrypoints      VAProfileNone                   :    VAEntrypointVideoProc      VAProfileNone                   :    VAEntrypointStats      VAProfileMPEG2Simple            :    VAEntrypointVLD      VAProfileMPEG2Simple            :    VAEntrypointEncSlice      VAProfileMPEG2Main              :    VAEntrypointVLD      VAProfileMPEG2Main              :    VAEntrypointEncSlice      VAProfileH264Main               :    VAEntrypointVLD      VAProfileH264Main               :    VAEntrypointEncSlice      VAProfileH264Main               :    VAEntrypointFEI      VAProfileH264Main               :    VAEntrypointEncSliceLP      VAProfileH264High               :    VAEntrypointVLD      VAProfileH264High               :    VAEntrypointEncSlice      VAProfileH264High               :    VAEntrypointFEI      VAProfileH264High               :    VAEntrypointEncSliceLP      VAProfileVC1Simple              :    VAEntrypointVLD      VAProfileVC1Main                :    VAEntrypointVLD      VAProfileVC1Advanced            :    VAEntrypointVLD      VAProfileJPEGBaseline           :    VAEntrypointVLD      VAProfileJPEGBaseline           :    VAEntrypointEncPicture      VAProfileH264ConstrainedBaseline:    VAEntrypointVLD      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice      VAProfileH264ConstrainedBaseline:    VAEntrypointFEI      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSliceLP      VAProfileVP8Version0_3          :    VAEntrypointVLD      VAProfileHEVCMain               :    VAEntrypointVLD      VAProfileHEVCMain               :    VAEntrypointEncSlice      VAProfileHEVCMain               :    VAEntrypointFEI

    hat jemand einen Tipp ?

    Ich kenne mich damit nicht aus.

    Code
    ffmpeg -i test_01.avi -pix_fmt yuvj420p -f mjpeg -q 0 pipe:1 | ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -hwaccel_output_format vaapi -i pipe:0 -c:v h264_vaapi -y output.mkv


    Ist auch nicht das gelbe vom Ei.

  • Was bringt denn?

    ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i test_01_422.avi -vf 'scale_vaapi=format=nv12' -c:v h264_vaapi ... output.mp4

  • Hatte ich auch schon getestet und sollte eigentlich auch funktionieren. Es wird tatsächlich mit über 8x speed eine mp4-Datei erstellt. Es werden im Terminal keinerlei Fehler angezeigt.

    Aaaaber .... es ist kein Bildinhalt vorhanden, nur abwechelnd ein grün/rosa Bildflackern.

    Falls du Interesse hast das mal selbst zu testen, hier ein ganz kurzer yuvj422p-AVI-Schnipsel:

    https://drive.google.com/file/d/1PHjHzT…iew?usp=sharing

  • Also mein Uralt-Intel will das jpeg überhaupt nicht dekodieren.

    Dekodiert er bei dir anständig? Also per VAAPI dekodieren -> per hwdownload den Frame von Videospeicher in den Hauptspeicher -> mit libx264 kodieren:

    ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i datei.avi -vf 'hwdownload,format=nv12' -c:v libx264 -crf 20 output.mp4

  • Nein, kein Decoding möglich da yuvj422p. Kann man hiermit gut testen:

    Code
    ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i test_01.avi -f null -

    Ich habe das avi auch als yuvj420p ... und damit klappt es. Es kann nur an dem Farbraum liegen.

  • Kann er denn Dateien, die mit x264 und crf 0 erzeugt wurden, dekodieren? Wie mjpeg auch lossless. Also das Capture Format ändern, falls das ne Option ist.

  • Das Captureformat ist festgelegt auf mjpeg. Der Farbraum / Chroma subsampling ist ebenfalls nicht änderbar.

    Ich hab einfach mal das yuvj422p Test-Avi mit libx264 crf 0 nach mp4 encodet (test_01.mp4), nur testweise. Die mp4-Datei hat immer noch yuvj422p. Aaaaber nun klappt es mit:

    Code
    ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i test_01.mp4 -f null -


    Hilft mir zwar auch nix, aber das versteh wer will. ???

  • Mein Englisch ist miserabel. Aber vielleicht kannst du mir dabei helfen.

    Und dann noch: You are not allowed to post or reply until you have been registered for at least 5 days.

    Ich hab hier mal einen Beitrag erstellt um drüben einen Thread aufzumachen:

    ffmpeg - vaapi

    Hi,

    my system:

    Code
    Kernel: 4.16.11-1-ARCH Resolution: 2560x1440 Terminal: xfce4-terminal CPU: Intel i7-6700K (8) @ 4.200GHz GPU: Intel HD Graphics 530 GPU: NVIDIA GeForce GTX 750 Ti Memory: 31094MiB
    Code
    vainfolibva info: VA-API version 1.1.0libva info: va_getDriverName() returns 0libva info: Trying to open /usr/lib/dri/i965_drv_video.solibva info: Found init function __vaDriverInit_1_1libva info: va_openDriver() returns 0vainfo: VA-API version: 1.1 (libva 2.1.0)vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 2.1.0vainfo: Supported profile and entrypoints      VAProfileMPEG2Simple            :    VAEntrypointVLD      VAProfileMPEG2Simple            :    VAEntrypointEncSlice      VAProfileMPEG2Main              :    VAEntrypointVLD      VAProfileMPEG2Main              :    VAEntrypointEncSlice      VAProfileH264ConstrainedBaseline:    VAEntrypointVLD      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice      VAProfileH264ConstrainedBaseline:    VAEntrypointEncSliceLP      VAProfileH264ConstrainedBaseline:    VAEntrypointFEI      VAProfileH264ConstrainedBaseline:    VAEntrypointStats      VAProfileH264Main               :    VAEntrypointVLD      VAProfileH264Main               :    VAEntrypointEncSlice      VAProfileH264Main               :    VAEntrypointEncSliceLP      VAProfileH264Main               :    VAEntrypointFEI      VAProfileH264Main               :    VAEntrypointStats      VAProfileH264High               :    VAEntrypointVLD      VAProfileH264High               :    VAEntrypointEncSlice      VAProfileH264High               :    VAEntrypointEncSliceLP      VAProfileH264High               :    VAEntrypointFEI      VAProfileH264High               :    VAEntrypointStats      VAProfileH264MultiviewHigh      :    VAEntrypointVLD      VAProfileH264MultiviewHigh      :    VAEntrypointEncSlice      VAProfileH264StereoHigh         :    VAEntrypointVLD      VAProfileH264StereoHigh         :    VAEntrypointEncSlice      VAProfileVC1Simple              :    VAEntrypointVLD      VAProfileVC1Main                :    VAEntrypointVLD      VAProfileVC1Advanced            :    VAEntrypointVLD      VAProfileNone                   :    VAEntrypointVideoProc      VAProfileJPEGBaseline           :    VAEntrypointVLD      VAProfileJPEGBaseline           :    VAEntrypointEncPicture      VAProfileVP8Version0_3          :    VAEntrypointVLD      VAProfileVP8Version0_3          :    VAEntrypointEncSlice      VAProfileHEVCMain               :    VAEntrypointVLD      VAProfileHEVCMain               :    VAEntrypointEncSlice

    Why is it not possible to decode this avi-file ?

    https://drive.google.com/file/d/1PHjHzT…iew?usp=sharing

    Code
    GeneralComplete name                            : /media/a5_Lwork/va/test_01_.aviFormat                                   : AVIFormat/Info                              : Audio Video InterleaveFile size                                : 30.6 MiBDuration                                 : 4 s 120 msOverall bit rate                         : 62.3 Mb/sVideoID                                       : 0Format                                   : JPEGCodec ID                                 : MJPGDuration                                 : 4 s 120 msBit rate                                 : 59.2 Mb/sWidth                                    : 1 920 pixelsHeight                                   : 1 080 pixelsDisplay aspect ratio                     : 16:9Frame rate                               : 25.000 FPSColor space                              : YUVChroma subsampling                       : 4:2:2Bit depth                                : 8 bitsScan type                                : ProgressiveCompression mode                         : LossyBits/(Pixel*Frame)                       : 1.142Stream size                              : 29.1 MiB (95%)AudioID                                       : 1Format                                   : PCMFormat profile                           : FloatCodec ID                                 : 00000003-0000-0010-8000-00AA00389B71Codec ID/Hint                            : IEEE Duration                                 : 4 s 120 msBit rate mode                            : ConstantBit rate                                 : 3 072 kb/sChannel(s)                               : 2 channelsChannel positions                        : Front: L RSampling rate                            : 48.0 kHzBit depth                                : 32 bitsStream size                              : 1.51 MiB (5%)Alignment                                : Aligned on interleavesInterleave, duration                     : 45  ms (1.12 video frame)Interleave, preload duration             : 500  ms

    bye ggrub

    LigH

    Um jetzt nicht 5 Tage warten zu müssen kannst du diesen Beitrag gerne ins Doom9 Forum stellen.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!