Opened 4 years ago

Closed 4 years ago

#4415 closed defect (worksforme)

Multi-threaded Multi-slice H264 decode gives incorrect error.

Reported by: mmorrison Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords: h264
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Using slice-based multithreaded decode with the H264 decoder produces the error "changing width/height on slice N" when the width and height have not changed. There appears there may be a bug in the logic and/or some variables are not properly initialized.

How to reproduce:
Using the attached Record1MDVideoX.h264 file (which seems to be correct..)

$ ffmpeg -y -threads 4 -thread_type slice -i /mnt/u/Record1MDVideoX.h264 test.mp4

I am currently using ffmpeg 2.1.4 but the same can be reproduced on the latest ffmpeg as well. I instrumented the method decode_slice_header as attached and it produced the following output:

$ ffmpeg -y -threads 4 -thread_type slice -i /mnt/u/Record1MDVideo.h264 test.mp4
ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 31 2015 11:57:39 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration:
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104

[h264 @ 0x2678640] pps.sps_id: 1 current_sps_id: -1
[h264 @ 0x2678640] hw: 0 sw: 80
[h264 @ 0x2678640] hh: 0 sh: 45
[h264 @ 0x2678640] hbpsw: 8 sbdl: 8
[h264 @ 0x2678640] hccfi: 1 scfi: 1
[h264 @ 0x2678640] needs_reinit 0
Input #0, h264, from '/mnt/u/Record1MDVideo.h264':

Duration: N/A, bitrate: N/A

Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1200k tbn, 60 tbc

Output #0, mp4, to 'test.mp4':

Metadata:

encoder : Lavf55.19.104
Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 15360 tbn, 30 tbc

Stream mapping:

Stream #0:0 -> #0:0 (h264 -> mpeg4)

Press [q] to stop, ? for help
[h264 @ 0x2678640] pps.sps_id: 1 current_sps_id: -1
[h264 @ 0x2678640] hw: 0 sw: 80
[h264 @ 0x2678640] hh: 0 sh: 45
[h264 @ 0x2678640] hbpsw: 8 sbdl: 8
[h264 @ 0x2678640] hccfi: 1 scfi: 1
[h264 @ 0x2678640] needs_reinit 0
[h264 @ 0x2678640] pps.sps_id: 1 current_sps_id: 0
[h264 @ 0x2678640] hbdl: 0 sbdl: 8
[h264 @ 0x2678640] hcfi: 0 scfi: 1
[h264 @ 0x2678640] needs_reinit 1
[h264 @ 0x2678640] h: 0x3352080 h0: 0x32e3f60
[h264 @ 0x2678640] 1280x720 vs 1280x720
[h264 @ 0x2678640] mr: 0 nr: 1
[h264 @ 0x2678640] changing width/height on slice 2
[h264 @ 0x2678640] decode_slice_header error
[h264 @ 0x2678640] pps.sps_id: 1 current_sps_id: 0
[h264 @ 0x2678640] hbdl: 0 sbdl: 8
[h264 @ 0x2678640] hcfi: 0 scfi: 1
[h264 @ 0x2678640] needs_reinit 1
[h264 @ 0x2678640] h: 0x33c01a0 h0: 0x32e3f60
[h264 @ 0x2678640] 1280x720 vs 1280x720
[h264 @ 0x2678640] mr: 0 nr: 1
[h264 @ 0x2678640] changing width/height on slice 3
[h264 @ 0x2678640] decode_slice_header error
[h264 @ 0x2678640] Cannot use next picture in error concealment
[h264 @ 0x2678640] concealing 2720 DC, 2720 AC, 2720 MV errors in P frame
[h264 @ 0x2678640] pps.sps_id: 1 current_sps_id: 0
[h264 @ 0x2678640] hbdl: 0 sbdl: 8
[h264 @ 0x2678640] hcfi: 0 scfi: 1
[h264 @ 0x2678640] needs_reinit 1
[h264 @ 0x2678640] h: 0x342e2c0 h0: 0x32e3f60
[h264 @ 0x2678640] 1280x720 vs 1280x720
[h264 @ 0x2678640] mr: 0 nr: 1
[h264 @ 0x2678640] changing width/height on slice 4
[h264 @ 0x2678640] decode_slice_header error
[h264 @ 0x2678640] Cannot use next picture in error concealment
[h264 @ 0x2678640] concealing 2720 DC, 2720 AC, 2720 MV errors in P frame
[h264 @ 0x2678640] pps.sps_id: 1 current_sps_id: 1
frame= 151 fps=0.0 q=31.0 size= 726kB time=00:00:05.03 bitrate=1181.8kbits/
[...]

Should we expect to get these errors every time we decode a multi-slice video with multiple threads?

Attachments (2)

Record1MDVideoX.h264 (132.2 KB) - added by mmorrison 4 years ago.
The test video file.
h264_part.c (29.0 KB) - added by mmorrison 4 years ago.
Modified Sources

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by mmorrison

The test video file.

Changed 4 years ago by mmorrison

Modified Sources

comment:1 Changed 4 years ago by mmorrison

  • Summary changed from Multi-threaded Multi-slice H264 decode incorrect error. to Multi-threaded Multi-slice H264 decode gives incorrect error.

comment:2 in reply to: ↑ description Changed 4 years ago by cehoyos

  • Keywords h264 added
  • Resolution set to worksforme
  • Status changed from new to closed

Replying to mmorrison:

I am currently using ffmpeg 2.1.4 but the same can be reproduced on the latest ffmpeg as well.

For future tickets, please provide the console output for latest FFmpeg.

Decoding worked fine for me last week and still works fine. I opened ticket #4416 for the regression in 2.6.

Note: See TracTickets for help on using tickets.