Opened 6 years ago

Closed 3 years ago

#2483 closed defect (fixed)

Cropping video with height=1 fails

Reported by: elektronaut Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: cropping
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Cropping a video with height 1px fails:
"-filter crop=848:1:0:240" fails with error message:
"[Parsed_crop_0 @ 026cff60] Invalid too big or non positive size for width '848' or height '0'"
How to reproduce:
Use a video as input an crop to a 1px high strip.

I know this is not very helpful but this instruction was working well with a ffmpeg version from September 2012. I am afraid I can not provide the version I used back then.

A height of 2px works fine.
I used a this

ffmpeg -i c:\strip\GOPR0492.MP4 -filter crop=848:1:0:240 "out0%6d.png" 

ffmpeg version N-52233-gee94362 
built on Apr 18 2013 02:50:33 with gcc 4.8.0 (GCC)

C:\strip>ffmpeg -i c:\strip\GOPR0492.MP4 -filter crop=848:1:0:240 "out0%6d.png"
 -v 9 -loglevel 99
ffmpeg version N-52233-gee94362 Copyright (c) 2000-2013 the FFmpeg developers built on Apr 18 2013 02:50:33 with gcc 4.8.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus--enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --ena
ble-zlib
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 56.103 /  3. 56.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'c:\strip\GOPR0492.MP4'.
Reading option '-filter' ... matched as option 'filter' (set stream filtergraph) with argument 'crop=848:1:0:240'.
Reading option 'out0%6d.png' ... matched as output file.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument '99'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file c:\strip\GOPR0492.MP4.
Successfully parsed a group of options.
Opening an input file: c:\strip\GOPR0492.MP4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 02249800] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 02249800] ISO: File Type Major Brand: avc1
[mov,mp4,m4a,3gp,3g2,mj2 @ 02249800] File position before avformat_find_stream_info() is 3047424
[h264 @ 0224b840] AVC: Consumed only 93163 bytes instead of 93166
[h264 @ 0224b840] Using externally provided dimensions
[h264 @ 0224b840] no picture
[mov,mp4,m4a,3gp,3g2,mj2 @ 02249800] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 02249800] File position after avformat_find_stream_info() is 3140977
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c:\strip\GOPR0492.MP4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    creation_time   : 2013-04-18 17:51:49
  Duration: 00:11:12.36, start: 0.000000, bitrate: 30179 kb/s
    Stream #0:0(eng), 1, 1/720000: Video: h264 (High) (avc1 / 0x31637661), yuvj 420p, 848x480 [SAR 1:1 DAR 53:30], 1/480, 30004 kb/s, 240 fps, 240 tbr, 720k tbn,  480 tbc
    Metadata:
      creation_time   : 2013-04-18 17:51:49
      handler_name    :  GoPro AVC
    Stream #0:1(eng), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      creation_time   : 2013-04-18 17:51:49
      handler_name    :  GoPro AAC
Successfully opened the file.
Parsing a group of options: output file out0%6d.png.
Applying option filter (set stream filtergraph) with argument crop=848:1:0:240.
Successfully parsed a group of options.
Opening an output file: out0%6d.png.
Successfully opened the file.
[Parsed_crop_0 @ 0224c2e0] Setting 'out_w' to value '848'
[Parsed_crop_0 @ 0224c2e0] Setting 'out_h' to value '1'
[Parsed_crop_0 @ 0224c2e0] Setting 'x' to value '0'
[Parsed_crop_0 @ 0224c2e0] Setting 'y' to value '240'
[graph 0 input from stream 0:0 @ 0224c1a0] Setting 'video_size' to value '848x480'
[graph 0 input from stream 0:0 @ 0224c1a0] Setting 'pix_fmt' to value '12'
[graph 0 input from stream 0:0 @ 0224c1a0] Setting 'time_base' to value '1/720000'
[graph 0 input from stream 0:0 @ 0224c1a0] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0224c1a0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0224c1a0] Setting 'frame_rate' to value '240/1'
[graph 0 input from stream 0:0 @ 0224c1a0] w:848 h:480 pixfmt:yuvj420p tb:1/720000 fr:240/1 sar:1/1 sws_param:flags=2
[format @ 0224c000] compat: called with args=[rgb24|rgba|rgb48be|rgba64be|pal8|gray|gray8a|gray16be|monob]
[format @ 0224c000] Setting 'pix_fmts' to value 'rgb24|rgba|rgb48be|rgba64be|pal8|gray|gray8a|gray16be|monob'
[auto-inserted scaler 0 @ 0224c420] Setting 'w' to value '0'
[auto-inserted scaler 0 @ 0224c420] Setting 'h' to value '0'
[auto-inserted scaler 0 @ 0224c420] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0224c420] w:0 h:0 flags:'0x4' interl:0
[format @ 0224c000] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_crop_0' and the filter 'format'
[AVFilterGraph @ 03f0e4c0] query_formats: 4 queried, 3 merged, 1 already done, 0 delayed
[auto-inserted scaler 0 @ 0224c420] picking rgb24 out of 7 ref:yuvj420p alpha:0
[Parsed_crop_0 @ 0224c2e0] w:848 h:480 sar:1/1 -> w:848 h:0 sar:1/1
[Parsed_crop_0 @ 0224c2e0] Invalid too big or non positive size for width '848' or height '0'
[graph 0 input from stream 0:0 @ 0224c1a0] Failed to configure input pad on Parsed_crop_0
Error opening filters!
[AVIOContext @ 0224a740] Statistics: 3009155 bytes read, 2 seeks


Change History (5)

comment:1 Changed 6 years ago by elektronaut

Ok, I found out which version was working with this command.

ffmpeg version N-34549-g13b7781, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov  6 2011 22:02:08 with gcc 4.6.1

comment:2 Changed 6 years ago by cehoyos

  • Component changed from FFmpeg to avfilter
  • Keywords cropping removed
  • Version changed from unspecified to git-master

Please test "-filter format=rgb24,crop=848:1:0:240"

comment:3 Changed 6 years ago by cehoyos

  • Keywords cropping added; crop removed

comment:4 Changed 6 years ago by elektronaut

The option

-filter format=rgb24,crop=848:1:0:240

works without any problems

comment:5 Changed 3 years ago by richardpl

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in 4d7d74802d0c857d365f95d7cd712581cce93323. See docs for explanation.

Note: See TracTickets for help on using tickets.