Opened 14 months ago

Last modified 14 months ago

#10212 open defect

Regression when trimming frames from the start

Reported by: Ondrej Mosnacek Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:

The latest ffmpeg fails one of the ffmpeg-python [1] tests. I know that version 4.2.7 works fine and the reproducer is simple and reliable, so I was able to bisect the regression to commit 9145c6d3b2e6 ("ffmpeg: move setting video sync method to new_video_stream()").

[1] https://github.com/kkroening/ffmpeg-python

How to reproduce:

% head -c $((32*32*3*10)) /dev/urandom | ./ffmpeg -f rawvideo -video_size 32x32 -framerate 10 -pixel_format rgb24 -i pipe:0 -filter_complex [0]trim=start_frame=2[s0] -map [s0] -f rawvideo pipe:1 | wc -c
ffmpeg version N-109896-g156ca86569 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (GCC)
  configuration: --disable-programs --enable-ffmpeg --disable-doc --disable-encoders --disable-decoders --enable-encoder=rawvideo --enable-decoder=rawvideo --disable-hwaccels --disable-muxers --enable-muxer=null --enable-muxer=rawvideo --disable-parsers --disable-bsfs --disable-devices --disable-filters --enable-filter=trim --disable-debug
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  4.100 / 60.  4.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
Input #0, rawvideo, from 'pipe:0':
  Duration: N/A, start: 0.000000, bitrate: 245 kb/s
  Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 32x32, 245 kb/s, 10 tbr, 10 tbn
Stream mapping:
  Stream #0:0 (rawvideo) -> trim:default
  trim:default -> Stream #0:0 (rawvideo)
Output #0, rawvideo, to 'pipe:1':
  Metadata:
    encoder         : Lavf60.4.100
  Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24(progressive), 32x32, q=2-31, 245 kb/s, 10 fps, 10 tbn
    Metadata:
      encoder         : Lavc60.4.100 rawvideo
frame=   10 fps=0.0 q=-0.0 Lsize=      30kB time=00:00:00.90 bitrate= 273.1kbits/s dup=2 drop=0 speed=1.09e+03x    
video:30kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
30720

The number output at the end should be 24576 (8 frames) instead of 30720 (10 frames).

Change History (2)

comment:1 by Gyan, 14 months ago

Analyzed by developer: set
Reproduced by developer: set
Status: newopen

Reproduced, and yes, 9145c6d3b2e6 is the offending commit.

video sync method adjustment relies on a parameter (source_index) which may be adjusted later on, in transcode_init(). But this commit moves the video sync assignment to a place earlier in the pipeline.

comment:2 by Gyan, 14 months ago

Looking further, bda06c60fe removed the adjustment itself.

Note: See TracTickets for help on using tickets.