Opened 6 years ago

Closed 5 years ago

#7410 closed defect (fixed)

mpeg4 decoding regression with multi-threading

Reported by: Carl Eugen Hoyos Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: asp regression handbrake
Cc: v0qiu24elio.ldb63qpfmjrkkiv9el@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

https://github.com/HandBrake/HandBrake/issues/1563
HandBrake user Gioni1 reported an mpeg4 decoding regression that manifests itself with threads >= 4, regression since d375c104, user-visible since 4478e9d8.

$ ffmpeg -threads 4 -i Austin.e.Ally.1x11.Compositori.e.stelle.marine_cut.avi -ss 5 -t 5 -qscale 2 out.avi
ffmpeg version N-91807-ga77c2df Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.4.0 (GCC)
  configuration: --enable-gpl --enable-gnutls --enable-libxml2
  libavutil      56. 19.100 / 56. 19.100
  libavcodec     58. 27.101 / 58. 27.101
  libavformat    58. 18.100 / 58. 18.100
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 26.100 /  7. 26.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[mpeg4 @ 0x40c3c80] Failed to parse extradata
Input #0, avi, from 'Austin.e.Ally.1x11.Compositori.e.stelle.marine_cut.avi':
  Duration: 00:00:12.12, start: 0.000000, bitrate: 1689 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 320 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (mp3 (mp3float) -> ac3 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf58.18.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 624x352 [SAR 1:1 DAR 39:22], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.27.101 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc58.27.101 ac3
[NULL @ 0x40c3c80] Ignoring multiple VOL headers
[mpeg4 @ 0x40eb100] Ignoring multiple VOL headers
frame=  125 fps=0.0 q=2.0 Lsize=    2099kB time=00:00:05.01 bitrate=3427.7kbits/s speed=34.6x
video:1965kB audio:118kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.774171%

The output file shows massive artefacts, works fine with -threads 1.

Attachments (1)

Change History (5)

comment:1 by Jacob, 6 years ago

Cc: v0qiu24elio.ldb63qpfmjrkkiv9el@gmail.com added

comment:2 by Carl Eugen Hoyos, 5 years ago

Keywords: asp added; mpeg4 removed

comment:3 by Andriy Gelman, 5 years ago

Hello,

I have posted a patch for this issue:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-December/237567.html

The artifact was created because a motion compensation parameter quarter_sample changed during decoding of an intra frame (frame number: 99). This change was not propagated to other frame decoding threads thus causing the artifact. I have solved this by initializing the value quarter_sample from previous decoding thread.

comment:4 by Carl Eugen Hoyos, 5 years ago

Resolution: fixed
Status: newclosed

Fixed by Andriy Gelman in 5282db5929f25ca9566a47ad217794842b364afc

Note: See TracTickets for help on using tickets.