[FFmpeg-trac] #2540(avcodec:new): -threads with libx264rgb do not work

FFmpeg trac at avcodec.org
Mon May 6 18:08:00 CEST 2013


#2540: -threads with libx264rgb do not work
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  hirschhornsalz                     |                 Priority:  normal
               Status:  new          |                  Version:  git-
            Component:  avcodec      |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 -threads options is ignored when using it with -c:v libx264rgb.


 Details:

 I use ffmpeg to grab video from a video game (World of Warcraft). The
 minimum requirements to successfully grab are 1920x1080 (HD) at 30 fps,
 with sound. The video data needs to be comressed somewhat, because the raw
 video stream of about 240 MByte/s isn't exactly easy manageable. I use
 libx264 with -preset ultrafast, which works reasonably well, because it
 runs on multiple cores (I use -threads 4), which get rarely over 30%
 usage.

 After upgrading from 0.11.7 to 1.2 I was no longer able to grab at the
 required frame rate - the bottleneck seems to be the RGB to YUV
 conversion, which seems to be a lot slower in newer versions.

 So I tried -c:v libx264rgb to avoid the costly rgb to yuv conversion, only
 to discover that it was even slower. The culprit is that threading is
 disabled. After enabling threading in the source code libx264rgb runs
 reasonably, and it outperforms the YUV version as expected.


 How to reproduce:
 {{{
 % ffmpeg -f x11grab -r 100 -s 1920x1080 -c:v libx264rgb -preset ultrafast
 -threads 4 -crf 20 test.avi

 frame=  208 fps= 27 q=14.0 Lsize=    1524kB time=00:00:09.09
 bitrate=1373.8kbits/s


 After changing line 746 in libavcodec/libx264.c from

     .capabilities   = CODEC_CAP_DELAY,

 to

     .capabilities   = CODEC_CAP_DELAY | CODEC_CAP_AUTO_THREADS,


 % ffmpeg -f x11grab -r 100 -s 1920x1080 -c:v libx264rgb -preset ultrafast
 -threads 4 -crf 20 test.avi

 frame=  757 fps= 94 q=-1.0 Lsize=    5238kB time=00:00:09.38
 bitrate=4574.7kbits/s
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2540>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list