Originally posted by atomsymbol
Announcement
Collapse
No announcement yet.
H.264 VA-API Encode Comes To Gallium3D
Collapse
X
-
Originally posted by haagch View PostIsn't that a simple color space conversion? I don't know much about video processing but I thought you should be able to do that in real time with no problems.
As you can see in my video, htop shows basically no significant CPU usage from any process.
Also I tried running an exact same pipeline on intel vaapi and radeonsi vaapi (including conversion to nv12) and the intel one was quite smooth while the radeonsi one was as choppy as you can see here.
For me top, like cpufreq, doesn't seem to register SIMD usage very well.
Of course my CPU is old and I only have ffmpeg to easily bench with (gstreamer in theory possible to bench, but I couldn't get it to work).
I could do 25fps so your observation about intel vs radeon is quite valid.
If you are not running the latest patches, there's quite a big memory leak lurking to mess things up.
Also if you don't specify cbr you get cqp which currently seems to defaul to 0 = huge/slow.
Your prime setup is quite different from me - so I guess there will be difference there (I am nowhere near as slow as you see), but vaapi is still somewhat slower than omx for me - but it's still early days.
Comment
-
Originally posted by legume View PostI made another reply hours ago which still hasn't turned up - makes typing out stuff rather pointless on here :-(
Comment
-
Originally posted by legume View PostOf course my CPU is old and I only have ffmpeg to easily bench with (gstreamer in theory possible to bench, but I couldn't get it to work).
LIBVA_DRIVER_NAME=radeonsi /usr/bin/time gst-launch-1.0 -e filesrc location=SampleVideo_1280x720_1mb.mp4 ! decodebin ! queue ! videoconvert ! queue ! video/x-raw,format=NV12 ! vaapih264enc ! h264parse ! matroskamux ! filesink location=output.mkv
Originally posted by legume View PostIf you are not running the latest patches, there's quite a big memory leak lurking to mess things up.
Originally posted by legume View PostAlso if you don't specify cbr you get cqp which currently seems to defaul to 0 = huge/slow.
No difference though, still takes 1:09 minutes.
So I revisited omx again.
/etc/xdg/gstomx.conf is the default location I believe. Mine looks a bit different:
Code:[omxh264dec] type-name=GstOMXH264Dec core-name=/usr/lib/libomxil-bellagio.so.0 component-name=OMX.radeonsi.video_decoder.avc rank=256 in-port-index=0 out-port-index=1 [omxmpeg2dec] type-name=GstOMXMPEG2VideoDec core-name=/usr/lib/libomxil-bellagio.so.0 component-name=OMX.radeonsi.video_decoder.mpeg2 rank=256 in-port-index=0 out-port-index=1 [omxh264enc] type-name=GstOMXH264Enc core-name=/usr/lib/libomxil-bellagio.so.0 component-name=OMX.radeonsi.video_encoder.avc rank=256 in-port-index=0 out-port-index=1
omxregister-bellagio produces this file: http://haagch.frickel.club/files/.omxregister
I believe this is totally wrong, but I have no working one to compare.
Comment
-
Originally posted by haagch View PostWell, you could do what I did and take http://www.sample-videos.com/video/m...y_720p_1mb.mp4 and run
LIBVA_DRIVER_NAME=radeonsi /usr/bin/time gst-launch-1.0 -e filesrc location=SampleVideo_1280x720_1mb.mp4 ! decodebin ! queue ! videoconvert ! queue ! video/x-raw,format=NV12 ! vaapih264enc ! h264parse ! matroskamux ! filesink location=output.mkv
Code:time gst-launch-1.0 -e filesrc location=~/big_buck_bunny_720p_1mb.mp4 ! qtdemux ! h264parse ! avdec_h264 ! queue ! videoconvert ! queue ! video/x-raw,format=NV12 ! vaapih264enc rate-control=cbr bitrate=2000 ! h264parse ! matroskamux ! filesink location=output.mkv Setting pipeline to PAUSED ... libva info: VA-API version 0.38.1 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_38 libva info: va_openDriver() returns 0 Pipeline is PREROLLING ... Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)NULL; Redistribute latency... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock Got EOS from element "pipeline0". Execution ended after 0:00:00.797613942 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ... real 0m1.236s user 0m1.284s sys 0m0.069s
ffmpeg -f x11grab -r 300 -s 1920x1080 -i :0.0 -f null -
and
ffmpeg -f x11grab -r 300 -s 1920x1080 -i :0.0 -pix_fmt nv12 -f null -
both of which output an fps result, I get -
100 and 22fps with cpufreq on_demand and
138 and 35fps with cpus full freq, maybe ffmpeg/my box is just exceptionally crap at this task!
omxregister-bellagio produces this file: http://haagch.frickel.club/files/.omxregister
I believe this is totally wrong, but I have no working one to compare.
Mine looks like -
Code:/usr/lib/bellagio/libomx_mesa.so ==> OMX.mesa.video_decoder ==> OMX.mesa.video_decoder.mpeg2:OMX.mesa.video_decoder.avc: ==> OMX.mesa.video_encoder ==> OMX.mesa.video_encoder.avc: /usr/lib/bellagio/libomxvideosched.so ==> OMX.st.video.scheduler ==> OMX.st.video.scheduler: ==> 2 1,456192 1,304128 /usr/lib/bellagio/libomxaudio_effects.so ==> OMX.st.volume.component ==> OMX.st.volume.component: ==> 2 1,65536 1,32768 ==> OMX.st.audio.mixer ==> OMX.st.audio.mixer: ==> 1 50,60000 /usr/lib/bellagio/libomxclocksrc.so ==> OMX.st.clocksrc ==> OMX.st.clocksrc:
Comment
-
Originally posted by legume View PostHmm, what does gstreamer say if you try to use it?Code:LC_ALL=C DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi gst-launch-1.0 videotestsrc ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! matroskamux ! filesink location=output.mkv Setting pipeline to PAUSED ... OMX-could not load /usr/lib/bellagio/libomxvideosched.so ==> OMX.st.video.scheduler ==> OMX.st.video.scheduler: ==> 2 1,456192 1,304128: /usr/lib/bellagio/libomxvideosched.so ==> OMX.st.video.scheduler ==> OMX.st.video.scheduler: ==> 2 1,456192 1,304128: cannot open shared object file: No such file or directory Pipeline is PREROLLING ... OMX-In RM_getResource No resource to be handled Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock
But I noticed it DOES produce an output file. It plays very slowly for some reason and mpv prints
Invalid video timestamp: 1.633000 -> 1.567000
every frame, but it seems to work otherwise.
I suppose that it didn't really work earlier whenever I tried, because the color format was wrong. With I420 I really get a data flow error with omxh264enc.
I just tried the equivalent:
DRI_PRIME=1 gst-launch-1.0 ximagesrc display-name=:0 use-damage=0 startx=0 starty=0 endx=1919 endy=1079 ! queue ! videoconvert ! queue ! video/x-raw,format=NV12,framerate=30/1 ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! matroskamux ! filesink location=output.mkv
and it produces this video:
25-30% CPU load and heavy artifacting, but it works.
Comment
-
Ah, misread the question. Are you sure it copies right into the phoronix wysiwyg editor?
With yours I get
Code:LC_ALL=C DRI_PRIME=1 gst-launch-1.0 ximagesrc display-name=:0 use-damage=0 startx=0 starty=0 endx=1919 endy=1079 ! queue ! videoconvert ! queue ! video/x-raw,format=NV12,frame rate=30/1 ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! matroskamux ! filesink location=output.mkv Setting pipeline to PAUSED ... OMX-could not load ==> OMX.mesa.video_decoder ==> OMX.mesa.video_decoder.mpeg2:OMX.mesa.video_decoder.avc:: ==> OMX.mesa.video_decoder ==> OMX.mesa.video_decoder.mpeg2:OMX.mesa.video_decode r.avc:: cannot open shared object file: No such file or directory OMX-could not load ==> OMX.mesa.video_encoder ==> OMX.mesa.video_encoder.avc:: ==> OMX.mesa.video_encoder ==> OMX.mesa.video_encoder.avc:: cannot open shared object file: No such file or di rectory OMX-could not load ==> OMX.st.video.scheduler ==> OMX.st.video.scheduler: ==> 2 1,456192 1,304128: ==> OMX.st.video.scheduler ==> OMX.st.video.scheduler: ==> 2 1,456192 1,304128: cannot ope n shared object file: No such file or directory OMX-could not load ==> OMX.st.volume.component ==> OMX.st.volume.component: ==> 2 1,65536 1,32768: ==> OMX.st.volume.component ==> OMX.st.volume.component: ==> 2 1,65536 1,32768: cannot ope n shared object file: No such file or directory OMX-could not load ==> OMX.st.audio.mixer ==> OMX.st.audio.mixer: ==> 1 50,60000: ==> OMX.st.audio.mixer ==> OMX.st.audio.mixer: ==> 1 50,60000: cannot open shared object file: No such file or directory OMX-could not load ==> OMX.st.clocksrc ==> OMX.st.clocksrc:: ==> OMX.st.clocksrc ==> OMX.st.clocksrc:: cannot open shared object file: No such file or directory Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... New clock: GstSystemClock OMX-In RM_getResource No resource to be handled
Tl;dr was: I noticed it does indeed produce an output file and I think on my previous tries maybe it didn't because of the color format. I420 produces a data flow error, but converted to NV12 works. Here's a video: https://www.youtube.com/watch?v=mbGDPtVIt9I. 20-25% CPU usage and very artifact-y, but works.Last edited by haagch; 18 July 2016, 04:18 AM.
Comment
Comment