This forum has been archived. All content is frozen. Please use KDE Discuss instead.

State of GPU video decoding in Kdenlive/FFMPEG

Tags: None
(comma "," separated)
ddennedy
Registered Member
Posts
1315
Karma
1
Running melt with -debug and grep-ing for vdpau is a good, sure way to figure out. No, there are no configure or compile switches. It is all automatic - you just need libvdpau-dev(el) installed when you build it as well as ffmpeg. Also, it requires the unreleased (or > v0.4.10) Git head version of MLT.


Bart Janssens
Registered Member
Posts
3
Karma
0
OS
I just compiled MLT with VDPAU support, and I do notice a good difference: playback of AVCHD content went from choppy to perfectly smooth. Compilation required manually setting the CFLAGS environment variable to -DVDPAU before configure, and removing the "ifdef VDPAU" block from src/modules/avformat/Makefile after configuring. After that, I see messages like "successfully created VDPAU surface 3" in the melt debug output.

Playback in kdenlive is also smooth, but when I seek to another position by clicking in the project timeline, it takes several seconds before the correct frame is displayed. Is this something that can be fixed?

P.S. I am new to kdenlive, just checked it out because I got a HD camcorder, and I am extremely impressed with it. If the seek delay problem can be solved, it will be perfect for my needs.
johanneswilm
Registered Member
Posts
8
Karma
0
Those who managed to get the VDPAU working, a few questions:

1. Is Kdenlive now actually usable for editing say 60 minute long videos in AVCHD for you?

2. What kind of hardware do you have?


The thing is I notice that apparently none of the commercial products manage to get this working just by using the GPU. All I find is them talking about min. requirements of quad Core or 2,8 Ghz CPUs. How come?


ddennedy
Registered Member
Posts
1315
Karma
1
Thank you for the feedback. You need to run ./configure after updating MLT sources to get VDPAU defined. The configure script runs a quick one-liner compilation against FFmpeg testing the presence of VDPAU in its build.

Yes, unfortunately, seeking is still too slow, and it is not something you can do about unless you can code and send a patch.


freddyx
Registered Member
Posts
19
Karma
0
I've build melt 0.5.0 and this is the output (play for 1-2 seconds) of: melt -debug sany0455.mp4

Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6cc080]ISO: File Type Major Brand: mp42
[h264 @ 0x6cd4b0]AVC: Consumed only 22 bytes instead of 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6cc080]All info found
Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6e1960]ISO: File Type Major Brand: mp42
[h264 @ 0x6e2990]AVC: Consumed only 22 bytes instead of 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6e1960]All info found
Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6f6bc0]ISO: File Type Major Brand: mp42
[h264 @ 0x6e7e70]AVC: Consumed only 22 bytes instead of 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6f6bc0]All info found
[mlt_producer 0x6bf8b0] sany0455.mp4
mlt_service_cache_put: name producer_avformat object 0x6bf8b0 data 0x6c15c0
mlt_cache_put: put 0 = 0x6bf8b0, 0x6c15c0
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
|1=-10| |2= -5| |3= -2| |4= -1| |5= 0| |6= 1| |7= 2| |8= 5| |9= 10|
+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+
+---------------------------------------------------------------------+
| H = back 1 minute, L = forward 1 minute |
| h = previous frame, l = next frame |
| g = start of clip, j = next clip, k = previous clip |
| 0 = restart, q = quit, space = play |
+---------------------------------------------------------------------+
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x74c0d0]ISO: File Type Major Brand: mp42
[h264 @ 0x74d350]AVC: Consumed only 22 bytes instead of 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x74c0d0]All info found
Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x761800]ISO: File Type Major Brand: mp42
[h264 @ 0x752520]AVC: Consumed only 22 bytes instead of 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x761800]All info found
Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x776570]ISO: File Type Major Brand: mp42
[h264 @ 0x767000]AVC: Consumed only 22 bytes instead of 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x776570]All info found
[producer avformat] audio: total_streams 1 max_stream 1 total_channels 2 max_channels 2
[producer avformat] sany0455.mp4
vdpau_init
[producer avformat] sany0455.mp4
X11 Display = 0x77bd70
[producer avformat] sany0455.mp4
vdpau_decoder_init
[producer avformat] sany0455.mp4
successfully created VDPAU surface 3
[producer avformat] sany0455.mp4
successfully created VDPAU surface 4
[producer avformat] sany0455.mp4
successfully created VDPAU surface 5
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
[producer avformat] sany0455.mp4
seeking timestamp 0 position 0 expected 0 last_pos -2
[producer avformat] sany0455.mp4
pkt.dts 0 req_pos 0 cur_pos -1 pkt_pos 0
[h264_vdpau @ 0x752520]AVC: Consumed only 22 bytes instead of 28
[producer avformat] sany0455.mp4
vdpau_get_buffer
[producer avformat] sany0455.mp4
got_pic 296 key 1
mlt_cache_put: put 0 = (nil), 0x7f797a693020
[filter deinterlace] error 0 deint 1 prog 1 fmt yuv422 method onefield
[filter gtkrescale] 1920x1080 -> 720x432 (yuv422)
[aac @ 0x767640]Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. If you heard an audible artifact, please submit the sample to the FFmpeg developers.
[consumer sdl] SDL failed to open audio: No available audio device
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
[producer avformat] sany0455.mp4
pkt.dts 1001 req_pos 1 cur_pos 0 pkt_pos 1
Last message repeated 1 times
[h264_vdpau @ 0x752520]AVC: Consumed only 57790 bytes instead of 57796
[producer avformat] sany0455.mp4
vdpau_get_buffer
[producer avformat] sany0455.mp4
got_pic 296 key 0
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 5
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 4
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 3
Current Position: 2
[consumer sdl] stopping put waiting
[consumer sdl] stopping consumer
mlt_cache_put: put 1 = 0x1, 0x7f79799c6020
[filter deinterlace] error 0 deint 1 prog 1 fmt yuv422 method onefield
[filter gtkrescale] 1920x1080 -> 720x432 (yuv422)
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 2
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
[producer avformat] sany0455.mp4
pkt.dts 2002 req_pos 2 cur_pos 1 pkt_pos 2
[h264_vdpau @ 0x752520]AVC: Consumed only 56536 bytes instead of 56540
[producer avformat] sany0455.mp4
vdpau_get_buffer
[producer avformat] sany0455.mp4
got_pic 296 key 0
mlt_cache_put: put 2 = 0x2, 0x7f79795c5020
[filter deinterlace] error 0 deint 1 prog 1 fmt yuv422 method onefield
[filter gtkrescale] 1920x1080 -> 720x432 (yuv422)
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
[producer avformat] sany0455.mp4
pkt.dts 3003 req_pos 4 cur_pos 2 pkt_pos 3
[h264_vdpau @ 0x752520]AVC: Consumed only 63175 bytes instead of 63180
[producer avformat] sany0455.mp4
vdpau_release_buffer (3)
[producer avformat] sany0455.mp4
vdpau_get_buffer
[producer avformat] sany0455.mp4
got_pic 0 key 0
[producer avformat] sany0455.mp4
pkt.dts 4004 req_pos 4 cur_pos 2 pkt_pos 4
[producer avformat] sany0455.mp4
vdpau_release_buffer (4)
[producer avformat] sany0455.mp4
vdpau_get_buffer
[producer avformat] sany0455.mp4
got_pic 296 key 0
mlt_cache_put: put 3 = 0x3, 0x7f79791c4020
[filter deinterlace] error 0 deint 1 prog 1 fmt yuv422 method onefield
[filter gtkrescale] 1920x1080 -> 720x432 (yuv422)
[producer avformat] sany0455.mp4
mlt_service_cache_get: name producer_avformat object 0x6bf8b0
mlt_cache_get: get 0 = 0x6bf8b0, 0x6c15c0
[producer avformat] sany0455.mp4
pkt.dts 5005 req_pos 5 cur_pos 4 pkt_pos 5
[producer avformat] sany0455.mp4
vdpau_release_buffer (5)
[producer avformat] sany0455.mp4
vdpau_get_buffer
[producer avformat] sany0455.mp4
got_pic 296 key 0
[consumer sdl] stopping read_ahead
mlt_cache_put: put 4 = 0x4, 0x7f7978dc3020
[filter deinterlace] error 0 deint 1 prog 1 fmt yuv422 method onefield
[filter gtkrescale] 1920x1080 -> 720x432 (yuv422)
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 4
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 3
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 2
[consumer sdl] stopped
mlt_cache_close: 0 = 0x6bf8b0
cache_object_close: item 0x6cdef0 object 0x6bf8b0 data 0x6c15c0 refcount 1
producer_avformat_close
[(null) 0x6bf8b0] vdpau_release_buffer (3)
[(null) 0x6bf8b0] vdpau_release_buffer (4)
[(null) 0x6bf8b0] vdpau_release_buffer (5)
[(null) 0x6bf8b0] vdpau_producer_close
mlt_cache_close: 4 = 0x4
cache_object_close: item 0x739410 object 0x4 data 0x7f7978dc3020 refcount 1
mlt_cache_close: 3 = 0x3
cache_object_close: item 0x729ee0 object 0x3 data 0x7f79791c4020 refcount 1
mlt_cache_close: 2 = 0x2
cache_object_close: item 0x7f79700059d0 object 0x2 data 0x7f79795c5020 refcount 1
mlt_cache_close: 1 = 0x1
cache_object_close: item 0x777f90 object 0x1 data 0x7f79799c6020 refcount 1
mlt_cache_close: 0 = (nil)
cache_object_close: item 0x762c90 object (nil) data 0x7f797a693020 refcount 1

As far as I can see it uses vdpau but on my quadcore, melt is using 1 core for 100% and video stutters. I have a NVIDIA 8500GT card.
Should there something wrong with my installation? Mplayer can play the same file with 1-2% CPU usage.
ddennedy
Registered Member
Posts
1315
Karma
1
mplayer uses the "presentation" part of VDPAU, meaning it leaves the decoded video in video memory. MLT is for video editing, and it must pull the decoded video back into system memory for additional processing and possibly encoding or SDI output. It does not optimize the case where all you do is play a single video file. This caveat was explained in MLT news when it was initially added to Git:
https://sourceforge.net/news/?group_id=96039&id=279508

BTW, I am working on some new code that adds more parallelism in the MLT processing pipeline, and this could potentially mean a single core system would be virtually dual core by offloading H.264 decoding to GPU leaving the CPU processor for this additional processing. This parallelism can scale with the number of cores.

FYI, 'melt -debug sany0455.mp4' implies '-profile dv_pal' which means it must scale the video. Currently, that is done on the CPU. VDPAU has some video processing like scaling, deinterlace, and levels adjustment, but that is not integrated.




Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]