Opened 10 months ago

Last modified 8 months ago

#10891 open defect

Some output frames have artifacts when decoded with multithreading

Reported by: HolyWu Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: h264
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Here are comparisons for 008, 011, and 014 pngs between threads 1 and threads 16.
https://slow.pics/c/s3uVPjB9

How to reproduce:

% ffmpeg -report -threads 16 -i 00006.MTS 00006_threads16/%03d.png
ffmpeg started on 2024-03-04 at 11:56:25
Report written to "ffmpeg-20240304-115625.log"
Log level: 48
ffmpeg version N-113925-g1a4e0eb374-20240303 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20240303
  libavutil      58. 40.100 / 58. 40.100
  libavcodec     60. 41.100 / 60. 41.100
  libavformat    60. 23.100 / 60. 23.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 14.100 /  4. 14.100
  libpostproc    57.  4.100 / 57.  4.100
Input #0, mpegts, from '00006.MTS':
  Duration: 00:00:11.07, start: 0.888889, bitrate: 15919 kb/s
  Program 1
  Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn
  Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
  Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle (pgssub) ([144][0][0][0] / 0x0090), 1920x1080
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to '00006_threads16/%03d.png':
  Metadata:
    encoder         : Lavf60.23.100
  Stream #0:0: Video: png, rgb24(pc, gbr/unknown/unknown, top coded first (swapped)), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn
      Metadata:
        encoder         : Lavc60.41.100 png
[out#0/image2 @ 00000226312faa40] video:955656KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=  331 fps= 42 q=-0.0 Lsize=N/A time=00:00:11.04 bitrate=N/A speed=1.41x

Attachments (1)

ffmpeg-20240304-115625.log (387.7 KB ) - added by HolyWu 10 months ago.

Download all attachments as: .zip

Change History (6)

by HolyWu, 10 months ago

Attachment: ffmpeg-20240304-115625.log added

comment:1 by HolyWu, 10 months ago

I have uploaded the sample 00006.MTS to VideoLAN file uploader. In case you don't see it, you can download it from https://drive.google.com/file/d/1XLpOaLfSKgydak2b_2y5sKIOP1bgNCtj/view?usp=sharing.

comment:2 by Gyan, 10 months ago

Status: newopen

Reproduced.

ffmpeg -v 0 -hide_banner -an -sn -threads 1 -i 00006.MTS -vframes 15 -f framehash -

#format: frame checksums
#version: 2
#hash: SHA256
#software: Lavf60.23.100
#tb 0: 1001/30000
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 1920x1080
#sar 0: 1/1
#stream#, dts,        pts, duration,     size, hash
0,          0,          0,        1,  3110400, 06eb7b7c1a85a58eb4a85de1d153a6143cb57f9a1ac64b2eede31a7eadfea391
0,          1,          1,        1,  3110400, 503ff51d3e2ae377b40918ecced72b992346a813e5ae8f928e9f77e8240bd2d1
0,          2,          2,        1,  3110400, ff1637e8e339341c25cd99fb645761e563dd95edb0e404bf94e5944ede35e9cf
0,          3,          3,        1,  3110400, e314332d1d3bd6c95101ad72a8b13ebc70e1c022d850904ced85991a1512105e
0,          4,          4,        1,  3110400, 475ac93b09e39ad1100e8ae7b92d58daccb29802c080fb467fca5dae7bd2104c
0,          5,          5,        1,  3110400, 6f267fe65b75390d4bcd0718d4e673e9d58e6cab42d777392274455534b80a5f
0,          6,          6,        1,  3110400, f5acf75aa5f419784aaeb4cc0c78af08f4dbbae5cdc70c23233c7169f428e082
0,          7,          7,        1,  3110400, bdd05a54bfcfb2909be61d3f0133c69ef148d2d77723bb5aadf899c711444b34
0,          8,          8,        1,  3110400, 0222548bdcdf6444e15e85702c01a9098731e7c24b24136a89ca6e2e115aac10
0,          9,          9,        1,  3110400, cf71d48ba4ccfd377638fc319e90203954f33d00f1504f7c11aa70e39fefc5bd
0,         10,         10,        1,  3110400, b424deec9158ab5c04a987e8be838f466965fd2d256b5f6969364b6b8c881fcd
0,         11,         11,        1,  3110400, 6297917fb96e2e3fd5d48a567d2f45fe9eb7998cab845fafdd8d292fd49e00a1
0,         12,         12,        1,  3110400, aaba02f5b27fa4bda6360e604fcf06629bc7ac5105faf0293ac095ad2949b7ce
0,         13,         13,        1,  3110400, cbe9143c332e5970b834fac0453e6b4d1b13a72c2f70354a618b8b6e849dd054
0,         14,         14,        1,  3110400, 01a25f759d533c24825277394fd9f1773a999ea4de3e5de251cfb4840387c004

ffmpeg -v 0 -hide_banner -an -sn -threads 16 -i 00006.MTS -vframes 15 -f framehash -

#format: frame checksums
#version: 2
#hash: SHA256
#software: Lavf60.23.100
#tb 0: 1001/30000
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 1920x1080
#sar 0: 1/1
#stream#, dts,        pts, duration,     size, hash
0,          0,          0,        1,  3110400, 06eb7b7c1a85a58eb4a85de1d153a6143cb57f9a1ac64b2eede31a7eadfea391
0,          1,          1,        1,  3110400, 503ff51d3e2ae377b40918ecced72b992346a813e5ae8f928e9f77e8240bd2d1
0,          2,          2,        1,  3110400, ff1637e8e339341c25cd99fb645761e563dd95edb0e404bf94e5944ede35e9cf
0,          3,          3,        1,  3110400, e314332d1d3bd6c95101ad72a8b13ebc70e1c022d850904ced85991a1512105e
0,          4,          4,        1,  3110400, 475ac93b09e39ad1100e8ae7b92d58daccb29802c080fb467fca5dae7bd2104c
0,          5,          5,        1,  3110400, 6f267fe65b75390d4bcd0718d4e673e9d58e6cab42d777392274455534b80a5f
0,          6,          6,        1,  3110400, f5acf75aa5f419784aaeb4cc0c78af08f4dbbae5cdc70c23233c7169f428e082
0,          7,          7,        1,  3110400, bdd05a54bfcfb2909be61d3f0133c69ef148d2d77723bb5aadf899c711444b34
0,          8,          8,        1,  3110400, 0222548bdcdf6444e15e85702c01a9098731e7c24b24136a89ca6e2e115aac10
0,          9,          9,        1,  3110400, cf71d48ba4ccfd377638fc319e90203954f33d00f1504f7c11aa70e39fefc5bd
0,         10,         10,        1,  3110400, 1f670f79b05e243e910140afc705a93bf8d8e533c29dd57b52d8e3b938697e21
0,         11,         11,        1,  3110400, 6297917fb96e2e3fd5d48a567d2f45fe9eb7998cab845fafdd8d292fd49e00a1
0,         12,         12,        1,  3110400, aaba02f5b27fa4bda6360e604fcf06629bc7ac5105faf0293ac095ad2949b7ce
0,         13,         13,        1,  3110400, 69c7e63f7c4d43fe67a1bb864c157c9581814855275d40f50e51bb7c365660ff
0,         14,         14,        1,  3110400, 01a25f759d533c24825277394fd9f1773a999ea4de3e5de251cfb4840387c004

Frames with dts 7, 10, 13 differ.

Up to 5 threads, there is no change.

comment:3 by Balling, 8 months ago

Here 5th, 8th, 11th frame differ. And only them...

By the way, I only have four core cpu, so I will only have five threads.

Last edited 8 months ago by Balling (previous) (diff)

comment:4 by Balling, 8 months ago

Keywords: h264 added

comment:5 by MasterQuestionable, 8 months ago

Cc: MasterQuestionable added
Priority: normalimportant

͏    https://streams.videolan.org/ffmpeg/incoming/10891/00006.MTS
͏    (~ 21.02 MiB; M2TS: H.264 (AVC) video, 11.044 s, 29.97 FPS, 1920x1080, YUV 4:2:0, ~ 19.57 MiB; A52/AC-3 audio, 11.072 s, 48,000 Hz, 346 KiB; ... ~ 1.11 MiB)

͏    Is it reproducible after remuxing to different container? (and losslessly cut only the affected segments?)
͏    [ E.g. https://bugzilla.mozilla.org/show_bug.cgi?id=1892185#c0 ]

[ Off-Topic:
͏    Also how to extract the subtitle stream of the sample file..? (misdetected by current (12.84) ExifTool as "PGS Audio")
͏    FFmpeg demands me to specify the correct ͏"-f"??
͏    [ ^ "-c copy -f sup" ("raw HDMV Presentation Graphic Stream subtitles") ]
͏    .
͏    “Subtitle encoding currently only possible from text to text or bitmap to bitmap”
͏    What's the point for "-c copy" then... ]

Note: See TracTickets for help on using tickets.