[FFmpeg-trac] #3020(avfilter:new): FFMPEG performance need optimize when transcoding to mjpeg

FFmpeg trac at avcodec.org
Wed Oct 2 08:24:24 CEST 2013


#3020: FFMPEG performance need optimize when transcoding to mjpeg
-------------------------------------+-------------------------------------
             Reporter:  kaifu.tang   |                     Type:
               Status:  new          |  enhancement
            Component:  avfilter     |                 Priority:  normal
             Keywords:  transcoder,  |                  Version:  2.0.1
  mjpeg, avfilter, performance       |               Blocked By:
             Blocking:               |  Reproduced by developer:  1
Analyzed by developer:  1            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 How to reproduce:
 {{{
 %time ffmpeg -i test.mp4 -vcodec mjpeg -s 960x640 -r 0.2 -y out.mov

 we may compare the real time with result of running scripts that
 transcoding to other video format, such as msmpeg4, x264,...

 ffmpeg version 2.0.1
 built on linux/MINGW32
 }}}

 Details see below:

 $ time ./ffmpeg -i test.mp4 -vcodec mjpeg -s 960x640 -r 0.2 -an -y out.mov
 ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
   built on Oct  1 2013 00:27:45 with gcc 4.3.2 (4.3.2-tdm-1 for MinGW)
   configuration: --disable-static --enable-shared --enable-gpl --enable-
 version3 --enable-nonfree --disable-ffserver --enable-memalign-hack
 --enable-pthreads --disable-txtpages
   libavutil      52. 46.100 / 52. 46.100
   libavcodec     55. 33.101 / 55. 33.101
   libavformat    55. 18.104 / 55. 18.104
   libavdevice    55.  3.100 / 55.  3.100
   libavfilter     3. 88.100 /  3. 88.100
   libswscale      2.  5.100 /  2.  5.100
   libswresample   0. 17.103 /  0. 17.103
   libpostproc    52.  3.100 / 52.  3.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: isommp42
     creation_time   : 2013-04-09 11:10:32
     copyright       :
     copyright-eng   :
   Duration: 00:03:53.87, start: 0.000000, bitrate: 897 kb/s
     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv,
 bt709), 1280x960, 846 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
     Metadata:
       creation_time   : 2013-04-09 11:10:30
       handler_name    : GPAC ISO Video Handler
     Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
 fltp, 47 kb/s (default)
     Metadata:
       creation_time   : 2013-04-09 11:10:32
       handler_name    : GPAC ISO Audio Handler
 [swscaler @ 03783020] deprecated pixel format used, make sure you did set
 range correctly
 Output #0, mov, to 'out.mov':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: isommp42
     copyright-eng   :
     copyright       :
     encoder         : Lavf55.18.104
     Stream #0:0(und): Video: mjpeg (jpeg / 0x6765706A), yuvj420p, 960x640,
 q=2-31, 200 kb/s, 16384 tbn, 0.20 tbc (default)
     Metadata:
       creation_time   : 2013-04-09 11:10:30
       handler_name    : GPAC ISO Video Handler
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 -> mjpeg)
 Press [q] to stop, [?] for help
 frame=   50 fps=0.7 q=0.0 Lsize=    4130kB time=00:04:10.00 bitrate=
 135.3kbits/s dup=0 drop=5561
 video:4129kB audio:0kB subtitle:0 global headers:0kB muxing overhead
 0.023129%

 real    1m9.687s
 user    0m0.031s
 sys     0m0.015s

 $ time ./ffmpeg -i test.mp4 -vcodec msmpeg4 -s 960x640 -r 0.2 -an -y
 out.avi
 ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
   built on Oct  1 2013 00:27:45 with gcc 4.3.2 (4.3.2-tdm-1 for MinGW)
   configuration: --disable-static --enable-shared --enable-gpl --enable-
 version3 --enable-nonfree --disable-ffserver --enable-memalign-hack
 --enable-pthreads --disable-txtpages
   libavutil      52. 46.100 / 52. 46.100
   libavcodec     55. 33.101 / 55. 33.101
   libavformat    55. 18.104 / 55. 18.104
   libavdevice    55.  3.100 / 55.  3.100
   libavfilter     3. 88.100 /  3. 88.100
   libswscale      2.  5.100 /  2.  5.100
   libswresample   0. 17.103 /  0. 17.103
   libpostproc    52.  3.100 / 52.  3.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: isommp42
     creation_time   : 2013-04-09 11:10:32
     copyright       :
     copyright-eng   :
   Duration: 00:03:53.87, start: 0.000000, bitrate: 897 kb/s
     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv,
 bt709), 1280x960, 846 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
     Metadata:
       creation_time   : 2013-04-09 11:10:30
       handler_name    : GPAC ISO Video Handler
     Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
 fltp, 47 kb/s (default)
     Metadata:
       creation_time   : 2013-04-09 11:10:32
       handler_name    : GPAC ISO Audio Handler
 Output #0, avi, to 'out.avi':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: isommp42
     copyright-eng   :
     ICOP            :
     ISFT            : Lavf55.18.104
     Stream #0:0(und): Video: msmpeg4v3 (msmpeg4) (MP43 / 0x3334504D),
 yuv420p, 960x640, q=2-31, 200 kb/s, 0.20 tbn, 0.20 tbc (default)
     Metadata:
       creation_time   : 2013-04-09 11:10:30
       handler_name    : GPAC ISO Video Handler
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 -> msmpeg4)
 Press [q] to stop, [?] for help
 frame=   49 fps=1.7 q=1.6 Lsize=    3972kB time=00:04:05.00 bitrate=
 132.8kbits/s dup=0 drop=5562
 video:3965kB audio:0kB subtitle:0 global headers:0kB muxing overhead
 0.169484%

 real    0m29.644s
 user    0m0.015s
 sys     0m0.031s

 I tested the benchmark of ffmpeg, and I can not find any issue in codec's
 performance, but I profiled the transcoder and find the performance issue
 is in the below call-chain, it is avfilter issue.
 main()->transcode()->transcode_step()->process_input()->output_packet()->decode_video()->av_buffersrc_add_frame_flags()->av_buffersrc_add_frame_internal()->ctx->output_pads[0].request_frame(ctx->outputs[0])

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


More information about the FFmpeg-trac mailing list