Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#1963 closed enhancement (worksforme)

ffv1 does not support threads

Reported by: Safari Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: ffv1
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: at max 15 fps encoding with ffv1 with i5-2500K CPU @ 3.30GHz, 1920x1200

with libx264 (crf 15) I get 60 fps (it supports threads).

How to reproduce:

ffmpeg -y -threads auto -f x11grab -show_region 1 -r 60 -s 1920,1200 -i :0.0 -vcodec ffv1 -q:v 0 -pix_fmt yuv444p -f matroska -t 3 jee.mkv
ffmpeg version N-73987-gc3e2ee7 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 22 2012 02:55:32 with gcc 4.7.2 (GCC) 20121109 (Red Hat 4.7.2-8)
  configuration: --cc=/usr/bin/gcc --enable-libvorbis --enable-libx264 --enable-libmp3lame --enable-gpl --enable-pthreads --enable-postproc --enable-libxvid --enable-libfaac --enable-libgsm --enable-libtheora --enable-libdc1394 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libschroedinger --enable-static --enable-gray --enable-avfilter --enable-version3 --enable-filter=all --enable-bsf=all --enable-libcelt --disable-stripping --disable-shared --enable-vdpau --enable-vaapi --enable-libcaca --enable-libaacplus --enable-libass --enable-x11grab --enable-libopus
  libavutil      52.  8.100 / 52.  8.100
  libavcodec     54. 74.100 / 54. 74.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.101 /  3. 23.101
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[x11grab @ 0x34d36e0] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1920 height: 1200
[x11grab @ 0x34d36e0] shared memory extension found
[x11grab @ 0x34d36e0] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1353785898.824541, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1200, -2147483 kb/s, 60 tbr, 1000k tbn, 60 tbc
Output #0, matroska, to 'jee.mkv':
  Metadata:
    encoder         : Lavf54.37.100
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv444p, 1920x1200, q=2-31, 200 kb/s, 1k tbn, 60 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> ffv1)
Press [q] to stop, [?] for help
frame=  180 fps=15.2 q=0.0 Lsize=   46359kB time=00:00:03.00 bitrate=126590.7kbits/s    
video:46356kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.005250%

perf top:

 69.76%  ffmpeg-20121122                          [.] encode_plane
  5.42%  ffmpeg-20121122                          [.] ff_hscale14to15_4_ssse3.loop
  2.48%  libc-2.15.so                             [.] __memcpy_ssse3_back
  2.16%  ffmpeg-20121122                          [.] ff_rgbaToUV_avx.loop
  1.73%  [kernel]                                 [k] copy_user_generic_string

Change History (6)

comment:1 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegavcodec
Keywords: ffv1 added
Resolution: worksforme
Status: newclosed

Use "-strict -2 -level 3"

comment:2 by Safari, 11 years ago

seems to use only two threads, I get max 32 fps

comment:3 by Carl Eugen Hoyos, 11 years ago

Is there a codec that succeeds on -r 60 ?

I suggest to test with a file to test the performance of a codec, you can also try to increase the number of threads and the slice_count.

comment:4 by Safari, 11 years ago

I get over 59 fps with x264. 1.8 CPUs utilized (out of 4).
I had "-threads auto" and -slice_count makes no difference.
Maybe if encode_plane was optimized for AVX, it could do 60 fps with one or two CPUs ;=)

in reply to:  4 comment:5 by Carl Eugen Hoyos, 11 years ago

Replying to Safari:

I had "-threads auto"

But you do realize that "-threads auto" is not the optimal choice in typical situations?
Please consider using the ffmpeg-user mailing list for usage questions, this tracker is primarily bugs (and feature requests), not for user support.

comment:6 by Safari, 11 years ago

I did not do user support request about -thread option usage, I had tried -threads 4 and -threads 8 and -threads 16, they did not make any difference. -threads auto does 5 threads.

Note: See TracTickets for help on using tickets.