Opened 13 years ago

Closed 11 years ago

#458 closed defect (fixed)

Scale filter can create output which scale filter cannot accept on its input

Reported by: Mark Himsley Owned by: Michael Niedermayer
Priority: important Component: undetermined
Version: git-master Keywords: crash abort
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I know this is a bit of a bizarre filter chain, It's constructed to
demonstrate the point I'm hoping to make, without using any of my code.

Clock10.mov is just a PAL DV, but I think any _interlaced_ file will do.

./ffmpeg -loglevel debug -i ~/Movies/Clock10.mov -vf
"slicify=32,scale=0:0:interl=1,format=yuv420p,scale=0:0:interl=1,format=yuv422p,scale=0:0:interl=1,format=yuv420p"
-pix_fmt yuv420p -vframes 1 -an -f rawvideo -y /dev/null

Essentially, the 'y' parameter in the slices of the output of the second
scale is not aligned by 4 (the first slice is, in fact, 26 lines high,
so the second slice starts at 26) so it is not valid for the input of
the third scale.

I don't think the output of this filter chain should throw an assert.

Change History (7)

comment:1 by Carl Eugen Hoyos, 13 years ago

Status: newopen

Complete, uncut output missing.
(And please consider pointing to a sample in http://samples.mplayerhq.hu/fate-suite/ or http://samples.mplayerhq.hu that allows to reproduce the problem.)

comment:2 by Mark Himsley, 13 years ago

ffmpeg -v 9 -loglevel 99 -i ~/Movies/Clock10.mov -vf "slicify=32,scale=0:0:interl=1,format=yuv420p,scale=0:0:interl=1,format=yuv422p,scale=0:0:interl=1,format=yuv420p" -pix_fmt yuv420p -vframes 1 -an -f rawvideo -y /dev/null
ffmpeg version N-32383-ga2b66a3, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep  7 2011 20:41:27 with gcc 4.0.1 (Apple Inc. build 5494)
  configuration: --extra-cflags='-I${PREFIX}/include -I/opt/local/include' --extra-libs='-L${PREFIX}/lib -L/opt/local/lib -mmacosx-version-min=10.5' --prefix=/Users/mdsh/ffmpeg --enable-shared --disable-indev=jack --cc=gcc-4.0 --enable-gpl --enable-nonfree --enable-pthreads
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 11. 0 / 53. 11. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 39. 0 /  2. 39. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x12b9000] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=95
[dvvideo @ 0x12cf800] Unsupported bit depth: 0
[dvvideo @ 0x12bae00] Unsupported bit depth: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x12b9000] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/mdsh/Movies/Clock10.mov':
  Metadata:
    creation_time   : 2009-06-23 19:40:06
  Duration: 00:00:10.00, start: 0.000000, bitrate: 29011 kb/s
    Stream #0.0(eng), 1, 1/2500: Video: dvvideo (dvcp / 0x70637664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/25, 28800 kb/s, 25 fps, 25 tbr, 2500 tbn, 25 tbc
    Metadata:
      creation_time   : 2009-06-23 19:40:07
    Stream #0.1(eng), 1, 1/2500: Video: dvvideo (dvcp / 0x70637664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/25, 28800 kb/s, 25 fps, 25 tbr, 2500 tbn, 25 tbc
    Metadata:
      creation_time   : 2009-06-23 19:40:07
[buffer @ 0xd63920] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:16/15 sws_param:
[scale @ 0xd63e20] w:720 h:576 fmt:yuv420p -> w:720 h:576 fmt:yuv420p flags:0x4
[scale @ 0xd64520] w:720 h:576 fmt:yuv420p -> w:720 h:576 fmt:yuv422p flags:0x4
[scale @ 0xd64a20] w:720 h:576 fmt:yuv422p -> w:720 h:576 fmt:yuv420p flags:0x4
[dvvideo @ 0x12cf800] Unsupported bit depth: 0
Output #0, rawvideo, to '/dev/null':
  Metadata:
    creation_time   : 2009-06-23 19:40:06
    encoder         : Lavf53.11.0
    Stream #0.0(eng), 0, 1/90000: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2009-06-23 19:40:07
Stream mapping:
  Stream #0.0 -> #0.0 (dvvideo -> rawvideo)
Press [q] to stop, [?] for help
[slicify @ 0xd63ea0] h:32
Assertion y%4 == 0 failed at libavfilter/vf_scale.c:316
Abort trap: 6
Last edited 13 years ago by Mark Himsley (previous) (diff)

comment:3 by Carl Eugen Hoyos, 13 years ago

Reproduced by developer: set
$ ./ffmpeg -i tests/lena.pnm -vf "slicify=32,scale=0:0,scale=0:0,format=yuv422p,scale=0:0:interl=1" -f null -
ffmpeg version N-32463-g3fec40b, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 11 2011 14:22:55 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 12. 0 / 53. 12. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 39. 0 /  2. 39. 0
  libswscale    2.  1. 0 /  2.  1. 0
Input #0, image2, from 'tests/lena.pnm':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x12a4640] w:256 h:256 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[scale @ 0x12a7800] w:256 h:256 fmt:rgb24 -> w:256 h:256 fmt:yuv420p flags:0x4
[scale @ 0x12a80a0] w:256 h:256 fmt:yuv420p -> w:256 h:256 fmt:yuv422p flags:0x4
[scale @ 0x12a90e0] w:256 h:256 fmt:yuv422p -> w:256 h:256 fmt:rgb24 flags:0x4
[swscaler @ 0x12e8b20] No accelerated colorspace conversion found from yuv422p to rgb24.
[swscaler @ 0x12ee6c0] No accelerated colorspace conversion found from yuv422p to rgb24.
[swscaler @ 0x12f4260] No accelerated colorspace conversion found from yuv422p to rgb24.
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf53.12.0
    Stream #0.0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 256x256, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (ppm -> rawvideo)
Press [q] to stop, [?] for help
Assertion y%4 == 0 failed at libavfilter/vf_scale.c:316
Aborted

comment:4 by Mark Himsley, 13 years ago

I have a better and much simpler demonstration, but it should mean the change of title for this ticket:

Pad filter can create output which scale filter cannot accept on its input.

Since the pad filter adds slices if it's adding lines at the top or bottom of the input, it's trivial to send slices into the interlaced scale filter that do not start at line%4.

ffmpeg -threads 4 -i ../576i25/Clock10tone.mov -an -vf pad=in_w:in_h+2:0:2:white,scale=0:0:interl=1,format=uyvy422 -r 25 -vcodec rawvideo -pix_fmt uyvy422 -y out.yuv
ffmpeg version N-31938-g3a9e227, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug 17 2011 14:37:20 with gcc 4.4.3
  configuration: --cpu=i686 --enable-static --extra-cflags='--static -I$PREFIX/include' --extra-libs='-static -L$PREFIX/lib' --prefix=/usr/local --disable-ffplay --disable-ffprobe --enable-gpl --enable-nonfree --enable-pthreads --enable-x11grab --enable-libdirac --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid
  libavutil    51. 12. 0 / 51. 12. 0
  libavcodec   53. 10. 0 / 53. 10. 0
  libavformat  53.  7. 0 / 53.  7. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 32. 0 /  2. 32. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb4bfc20] Unimplemented container channel layout.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb4bfc20] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ and contact the ffmpeg-devel mailing list.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/himslm01/Videos/576i25/Clock10tone.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2009-07-16 17:23:31
  Duration: 00:00:10.00, start: 0.000000, bitrate: 30334 kb/s
    Stream #0.0(eng): Video: dvvideo, yuv420p, 720x576 [SAR 64:45 DAR 16:9], 28800 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2009-07-16 17:23:31
    Stream #0.1(eng): Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    Metadata:
      creation_time   : 2009-07-16 17:23:31
[buffer @ 0xb4c80a0] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:64/45 sws_param:
[pad @ 0xb4ba320] w:720 h:576 -> w:720 h:578 x:0 y:2 color:0xEB8080FF[yuva]
[scale @ 0xb4b9900] w:720 h:578 fmt:yuv420p -> w:720 h:578 fmt:uyvy422 flags:0x4
Output #0, rawvideo, to 'out.yuv':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2009-07-16 17:23:31
    encoder         : Lavf53.7.0
    Stream #0.0(eng): Video: rawvideo, uyvy422, 720x578 [SAR 64:45 DAR 512:289], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Metadata:
      creation_time   : 2009-07-16 17:23:31
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
Assertion y%4 == 0 failed at libavfilter/vf_scale.c:311

comment:5 by Carl Eugen Hoyos, 12 years ago

$ ./ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -vf pad=in_w:in_h+2:0:2,scale=0:0:interl=1,format=uyvy422 -f null -
ffmpeg version N-44632-ga16c512 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 20 2012 16:11:00 with gcc 4.5.3 (GCC)
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 56.100 / 54. 56.100
  libavformat    54. 27.101 / 54. 27.101
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 16.105 /  3. 16.105
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x14f0240] max_analyze_duration 5000000 reached at 5000998
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/svq3/Vertical400kbit.sorenson3.mov':
  Metadata:
    creation_time   : 2001-03-20 16:17:18
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    encoder         : Sorenson Video 3
    encoder-eng     : Sorenson Video 3
  Duration: 00:00:43.57, start: 0.000000, bitrate: 580 kb/s
    Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p, 320x240, 391 kb/s, 30.02 fps, 30 tbr, 600 tbn, 600 tbc
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, mono, s16, 176 kb/s
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
Output #0, null, to 'pipe:':
  Metadata:
    encoder-eng     : Sorenson Video 3
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    encoder         : Lavf54.27.101
    Stream #0:0(eng): Video: rawvideo (UYVY / 0x59565955), uyvy422, 320x242, q=2-31, 200 kb/s, 90k tbn, 30 tbc
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (svq3 -> rawvideo)
  Stream #0:1 -> #0:1 (adpcm_ima_qt -> pcm_s16le)
Press [q] to stop, [?] for help
Multiple frames in a packet from stream 1
Assertion y%(2<<scale->vsub) == 0 failed at libavfilter/vf_scale.c:383
Aborted

comment:6 by Carl Eugen Hoyos, 11 years ago

Component: swscaleundetermined
Keywords: crash abort added
Priority: normalimportant

comment:7 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Not reproducible with latest git head.

Note: See TracTickets for help on using tickets.