[mythtv-users] Multi-threaded h.264 decoding in 0.21

Raymond Wagner raymond at wagnerrp.com
Sat Oct 4 16:38:35 UTC 2008


Carl-Magnus Björkell wrote:
> Johan wrote:
>   
>> Hi,
>>
>> I'm using the latest code from 0.21 fixes branch (r18536) and trying to
>> get a smooth h.264 playback on a Intel Core2Duo 2140 1.6 GHz. I have set
>> the "max CPU" setting in the display profile to 2 since it is a dual
>> core and according to the mythfrontend.log file is 2 cores used for
>> decoding in ffmpeg but when I'm watching a h.264 stream with the
>> internal mythtv player (like live tv) I get prebuffer pauses and one of
>> the threads in mythfrontend process is using 100% CPU according to ps
>> but that means 100% on one core and it does not seem to spread the
>> decoding on 2 cores properly. Is this not really supported in 0.21? Do I
>> need to go the CoreAVC path to get this working? I have tried running
>> both as a regular user and as root but there is no difference. The
>> kernel is configured for SMP and I can see two CPU:s in /proc/cpuinfo.
>> What is the problem?
>>
>>
>> top -H output during h.264 playback (with jerky video):
>>  
>> top - 15:00:55 up 1 min,  1 user,  load average: 0.56, 0.16, 0.05
>> Tasks: 102 total,   5 running,  97 sleeping,   0 stopped,   0 zombie
>> Cpu(s): 52.1%us,  0.8%sy,  0.0%ni, 45.3%id,  0.0%wa,  0.5%hi,  1.3%si, 
>> 0.0%st
>> Mem:   1032168k total,   325024k used,   707144k free,     7252k buffers
>> Swap:  1959920k total,        0k used,  1959920k free,   149960k cached
>>
>>   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
>>  3366 mythtv    20   0  334m 142m  68m R  100 14.1   0:18.65 mythfrontend
>>  3275 root      RT -10 99.8m  88m  51m S    6  8.8   0:02.47 Xorg
>>  3364 mythtv    20   0  334m 142m  68m R    1 14.1   0:00.28 mythfrontend
>>  3368 mythtv    20   0  334m 142m  68m S    1 14.1   0:00.14 mythfrontend
>>  3321 mythtv    20   0  4240 2048 1540 S    0  0.2   0:00.06 xscreensaver
>>  3329 mythtv    20   0  334m 142m  68m S    0 14.1   0:01.69 mythfrontend
>>  3367 mythtv    20   0  334m 142m  68m S    0 14.1   0:00.40 mythfrontend
>>  3372 mythtv    20   0  334m 142m  68m R    0 14.1   0:00.08 mythfrontend
>>  3359 root      20   0  2308 1112  852 R    0  0.1   0:00.04 top
>>     1 root      20   0  2088  680  580 S    0  0.1   0:00.78 init
>>
>>
>> lines from my mythfrontend.log file with -v all parameter:
>>
>> 2008-10-04 14:26:18.611 AFD: Stream #0, has id 0x4100 codec id H264,
>> type Video, bitrate 0 at 0x0xaa939df0
>> 2008-10-04 14:26:18.614 VDP: Accepting: cmp(> 1000 700) dec(ffmpeg)
>> cpus(2) rend(xv-blit) osd(softblend) osdfade(disabled) deint(none,none)
>> filt()
>> 2008-10-04 14:26:18.614 VDP: Accepting: cmp(> 0 0) dec(ffmpeg) cpus(2)
>> rend(xv-blit) osd(softblend) osdfade(disabled)
>> deint(linearblend,linearblend) filt()
>> 2008-10-04 14:26:18.614 VDP: LoadBestPreferences(2048x2048, 0)
>> 2008-10-04 14:26:18.614 VDP: LoadBestPreferences(2048x2048, 60)
>> 2008-10-04 14:26:18.615 VDP: LoadBestPreferences(1280x720, 60)
>> 2008-10-04 14:26:18.615 Using 2 CPUs for decoding
>> 2008-10-04 14:26:18.618 VDP: Accepting: cmp(> 1000 700) dec(ffmpeg)
>> cpus(2) rend(xv-blit) osd(softblend) osdfade(disabled) deint(none,none)
>> filt()
>> 2008-10-04 14:26:18.619 VDP: Accepting: cmp(> 0 0) dec(ffmpeg) cpus(2)
>> rend(xv-blit) osd(softblend) osdfade(disabled)
>> deint(linearblend,linearblend) filt()
>>
>>
>>     
>
> Hey,
>
> If there hasn't been a resent change in the decoding capabilities of
> ffmpeg it still can't do multithreaded h264 decoding. And since ffmpeg
> can't, mythtv, mplayer and all other projects that depend on it can't
> either. (Please do tell if there actually HAS been a change in this area
> :) )
>
> -NRG
>   
That's not entirely true. H.264 supports slices, where the video is 
segregated into multiple independent domains, and ffmpeg is capable of 
running each domain in a separate thread. This is all dependent on the 
encoder using slices, and may not be available if the source is single 
sliced. Hardware encoders such as the HDPVR encode in a single slice, 
and need considerably more power than a 1.6GHz Core2. Similarly, 
downloaded content ripped by someone who has no clue what they're doing 
may be single sliced.


More information about the mythtv-users mailing list