Opened 8 months ago

Last modified 8 months ago

#10518 new defect

crop corrupts pngs when the crop is close to the right and lower edges

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

Description

Summary of the bug:
When I try to crop e.g. the top right corner of a video into a png, the output is corrupted. I have to stay 10 ish pixels away from the right edge to make it work.

How to reproduce:
I am trying on a 1280x720 .mov prores video, I don't know if it matters.

crop=w=20:h=20:x=1260:y=0:exact=1:keep_aspect=0

Results in corrupted PNGs, whereas the following works just fine:

crop=w=20:h=20:x=1250:y=0:exact=1:keep_aspect=0

in stderr I see nothing that indicates there was an error

Attachments (5)

test_48_frames_only.mov (2.0 MB ) - added by wesnet12345 8 months ago.
Simple prores mov file that I am using for the test in case you don't have one.
1.png (240 bytes ) - added by wesnet12345 8 months ago.
2.png (240 bytes ) - added by wesnet12345 8 months ago.
3.png (250 bytes ) - added by wesnet12345 8 months ago.
4.png (240 bytes ) - added by wesnet12345 8 months ago.

Download all attachments as: .zip

Change History (11)

by wesnet12345, 8 months ago

Attachment: test_48_frames_only.mov added

Simple prores mov file that I am using for the test in case you don't have one.

comment:1 by Michael Koch, 8 months ago

I can't reproduce the issue. Please show the full console output.

comment:2 by Michael Koch, 8 months ago

The output image has a column of black pixels at the right. It doesn't care if x is close to the right border or not. Same problem also for x=0. Can be reproduced as follows:

C:\Users\astro\Desktop\LUT1D>ffmpeg -i test_48_frames_only.mov -vf crop=w=20:h=20:x=1260:y=0 -frames 1 -y out.png
ffmpeg version 2023-08-10-git-d9d5695390-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58. 16.101 / 58. 16.101
  libavcodec     60. 23.100 / 60. 23.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_48_frames_only.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2023-08-06T20:11:33.000000Z
  Duration: 00:00:01.60, start: 0.000000, bitrate: 10247 kb/s
  Stream #0:0[0x1](eng): Video: prores (Standard) (apcn / 0x6E637061), yuv422p10le(bt709, progressive), 1280x720, 5004 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 30 tbn (default)
    Metadata:
      creation_time   : 2023-08-06T20:11:33.000000Z
      handler_name    : Apple Video Media Handler
      vendor_id       : appl
      encoder         : Apple ProRes 422
      timecode        : 00:00:00:00
  Stream #0:1[0x2](eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2023-08-06T20:11:33.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 00:00:00:00
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'out.png':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf60.10.100
  Stream #0:0(eng): Video: png, rgb48be(pc, gbr/bt709/bt709, progressive), 20x20 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 30 fps, 30 tbn (default)
    Metadata:
      creation_time   : 2023-08-06T20:11:33.000000Z
      handler_name    : Apple Video Media Handler
      vendor_id       : appl
      timecode        : 00:00:00:00
      encoder         : Lavc60.23.100 png
[image2 @ 00000254acc00c40] The specified filename 'out.png' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 00000254acc00c40] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
[out#0/image2 @ 00000254acc00b40] video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x
Last edited 8 months ago by Michael Koch (previous) (diff)

comment:3 by Michael Koch, 8 months ago

Version: 6.0git-master

comment:4 by wesnet12345, 8 months ago

I really don't know what was causing the issue. Seems to be gone now. Had to stay away from the border previously. This is the full command I was using.

ffmpeg.exe -ss 0us -i "../test_48_frames.mov" -an -frames:v 30 -vf "fps=fps=15:round=inf , crop=w=10:h=10:x=1270:y=0:exact=1:keep_aspect=0 , setsar=1 , scale=10:10" ".../%d.png"

comment:5 by wesnet12345, 8 months ago

try this please on the video I attached
crop=w=5:h=5:x=1275:y=0:exact=1:keep_aspect=0

I am attaching the corrupted pngs also.

by wesnet12345, 8 months ago

Attachment: 1.png added

by wesnet12345, 8 months ago

Attachment: 2.png added

by wesnet12345, 8 months ago

Attachment: 3.png added

by wesnet12345, 8 months ago

Attachment: 4.png added

in reply to:  5 comment:6 by Michael Koch, 8 months ago

Replying to wesnet12345:

try this please on the video I attached
crop=w=5:h=5:x=1275:y=0:exact=1:keep_aspect=0

I am attaching the corrupted pngs also.

Crazy output. Full command line for reproducing:

ffmpeg -i test_48_frames_only.mov -vf crop=w=5:h=5:x=1275:y=0:exact=1 -frames 1 -y out.png
Last edited 8 months ago by Michael Koch (previous) (diff)
Note: See TracTickets for help on using tickets.