[FFmpeg-trac] #9712(undetermined:new): Output of crop as rawvideo is offset by one frame
FFmpeg
trac at avcodec.org
Tue Apr 5 10:36:28 EEST 2022
#9712: Output of crop as rawvideo is offset by one frame
-------------------------------------+-------------------------------------
Reporter: Denis | Type: defect
Warburton |
Status: new | Priority: normal
Component: | Version: git-
undetermined | master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
I am using FFmpeg to extract a single line from every frame of a ProRes
Quicktime file, which is then written to a file as raw, 8-bit grayscale
values. (The output file is then read by programs which process waveforms
for closed captioning and other data signals.)
The issue that I have encountered is that FFmpeg appears to skip the first
frame of the input ProRes file (frame 0), resulting in a one-frame offset
between the original file and the extracted data. In the provided sample,
the closed caption waveform appears one frame early in the extracted data
(in the position of frame 25, instead of 26). This is unexpected behavior,
as I didn’t specify any offset or change in duration.
I am uncertain if this is a bug, or intended behavior that can be modified
via an option. Either way, I greatly thank you in advance for your help
and insight into this matter.
If it would be helpful, I can also provide a timecode / frame count burn
of the provided sample (created using DaVinci Resolve).
[
The “line21” output can be visualized with imagemagick using the following
command:
convert -size 720x60 -depth 8 gray:BTA003-05.line21 BTA003-05.jpg
The provided sample was extracted from the original ProRes file with
ffmpeg v4.4 using the following command:
ffmpeg -ss 6 -i BTA003-05.mov -t 2 -map 0 -c copy
~/Desktop/Sample/BTA003-05.mov
]
How to reproduce:
{{{
ffmpeg started on 2022-04-04 at 17:24:32
Report written to "ffmpeg-20220404-172432.log"
Log level: 48
Command line:
/Users/useraccount/Downloads/ffmpeg -i
/Users/useraccount/Desktop/Sample/BTA003-05.mov -filter:v "crop=720:1:0:1"
-f rawvideo -vcodec rawvideo -pix_fmt gray8
/Users/useraccount/Desktop/Sample/BTA003-05.line21 -report
ffmpeg version N-106490-gbb4e0f6162-tessus Copyright (c) 2000-2022 the
FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-
version=tessus --enable-avisynth --enable-fontconfig --enable-gpl
--enable-libaom --enable-libass --enable-libbluray --enable-libdav1d
--enable-libfreetype --enable-libgsm --enable-libmodplug --enable-
libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-
libopus --enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq
--enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-
ffplay
libavutil 57. 24.101 / 57. 24.101
libavcodec 59. 25.100 / 59. 25.100
libavformat 59. 20.101 / 59. 20.101
libavdevice 59. 6.100 / 59. 6.100
libavfilter 8. 30.100 / 8. 30.100
libswscale 6. 6.100 / 6. 6.100
libswresample 4. 6.100 / 4. 6.100
libpostproc 56. 5.100 / 56. 5.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument
'/Users/useraccount/Desktop/Sample/BTA003-05.mov'.
Reading option '-filter:v' ... matched as option 'filter' (set stream
filtergraph) with argument 'crop=720:1:0:1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'rawvideo'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'rawvideo'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
format) with argument 'gray8'.
Reading option '/Users/useraccount/Desktop/Sample/BTA003-05.line21' ...
matched as output url.
Reading option '-report' ... matched as option 'report' (generate a
report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url
/Users/useraccount/Desktop/Sample/BTA003-05.mov.
Successfully parsed a group of options.
Opening an input file: /Users/useraccount/Desktop/Sample/BTA003-05.mov.
[NULL @ 0x7fa44cd007c0] Opening
'/Users/useraccount/Desktop/Sample/BTA003-05.mov' for reading
[file @ 0x7fa44cd00c80] Setting default whitelist 'file,crypto,data'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] Format mov,mp4,m4a,3gp,3g2,mj2
probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] ISO: File Type Major Brand: qt
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] Unknown dref type 0x206c7275
size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] Processing st: 0, edit list 0 -
media time: 328, duration: 24072
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] drop a frame at curr_cts: 0 @ 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] Unknown dref type 0x206c7275
size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] Processing st: 1, edit list 0 -
media time: 1919, duration: 96384
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] drop a frame at curr_cts: 0 @ 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] skip 895 audio samples from
curr_cts: 1024
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] Before
avformat_find_stream_info() pos: 6769759 bytes read:35499 seeks:1
nb_streams:2
[prores @ 0x7fa44cd015c0] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] demuxer injecting skip 1919 /
discard 0
[prores @ 0x7fa44cd015c0] Format yuv422p10le chosen by get_format().
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa44cd007c0] After
avformat_find_stream_info() pos: 8036 bytes read:68267 seeks:2 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Users/useraccount/Desktop/Sample/BTA003-05.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.76.100
Duration: 00:00:02.01, start: 0.000000, bitrate: 26957 kb/s
Stream #0:0[0x1](eng), 1, 1/11988: Video: prores (Standard) (apcn /
0x6E637061), yuv422p10le(tv, smpte170m/unknown/unknown, bottom coded first
(swapped)), 720x486, 25785 kb/s, SAR 10:11 DAR 400:297, 29.97 fps, 29.97
tbr, 11988 tbn (default)
Metadata:
handler_name : Apple Video Media Handler
vendor_id : FFMP
Stream #0:1[0x2](eng), 1, 1/48000: Audio: pcm_s24le (in24 / 0x34326E69),
48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
handler_name : Apple Sound Media Handler
vendor_id : [0][0][0][0]
Successfully opened the file.
Parsing a group of options: output url
/Users/useraccount/Desktop/Sample/BTA003-05.line21.
Applying option filter:v (set stream filtergraph) with argument
crop=720:1:0:1.
Applying option f (force format) with argument rawvideo.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument rawvideo.
Applying option pix_fmt (set pixel format) with argument gray8.
Successfully parsed a group of options.
Opening an output file:
/Users/useraccount/Desktop/Sample/BTA003-05.line21.
[file @ 0x7fa44cd05f40] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
detected 12 logical cores
[prores @ 0x7fa44cd06c80] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd07640] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd08040] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd08a00] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd093c0] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd09d80] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0a780] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0b140] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0bb00] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0c4c0] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0cec0] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0d880] Auto bitdepth precision. Use 10b decoding based
on codec tag.
[prores @ 0x7fa44cd0e240] Auto bitdepth precision. Use 10b decoding based
on codec tag.
Stream mapping:
Stream #0:0 -> #0:0 (prores (native) -> rawvideo (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
[prores @ 0x7fa44cd06c80] Format yuv422p10le chosen by get_format().
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
[Parsed_crop_0 @ 0x7fa44e900040] Setting 'out_w' to value '720'
[Parsed_crop_0 @ 0x7fa44e900040] Setting 'out_h' to value '1'
[Parsed_crop_0 @ 0x7fa44e900040] Setting 'x' to value '0'
[Parsed_crop_0 @ 0x7fa44e900040] Setting 'y' to value '1'
[graph 0 input from stream 0:0 @ 0x7fa44e900580] Setting 'video_size' to
value '720x486'
[graph 0 input from stream 0:0 @ 0x7fa44e900580] Setting 'pix_fmt' to
value '64'
[graph 0 input from stream 0:0 @ 0x7fa44e900580] Setting 'time_base' to
value '1/11988'
[graph 0 input from stream 0:0 @ 0x7fa44e900580] Setting 'pixel_aspect' to
value '10/11'
[graph 0 input from stream 0:0 @ 0x7fa44e900580] Setting 'frame_rate' to
value '2997/100'
[graph 0 input from stream 0:0 @ 0x7fa44e900580] w:720 h:486
pixfmt:yuv422p10le tb:1/11988 fr:2997/100 sar:10/11
[format @ 0x7fa44e900a40] Setting 'pix_fmts' to value 'gray'
[auto_scale_0 @ 0x7fa44e901080] w:iw h:ih flags:'' interl:0
[format @ 0x7fa44e900a40] auto-inserting filter 'auto_scale_0' between the
filter 'Parsed_crop_0' and the filter 'format'
[AVFilterGraph @ 0x7fa44ce00e00] query_formats: 4 queried, 3 merged, 1
already done, 0 delayed
[Parsed_crop_0 @ 0x7fa44e900040] w:720 h:486 sar:10/11 -> w:720 h:1
sar:10/11
[auto_scale_0 @ 0x7fa44e901080] w:720 h:1 fmt:yuv422p10le sar:10/11 ->
w:720 h:1 fmt:gray sar:10/11 flags:0x0
[auto_scale_0 @ 0x7fa44e901080] w:720 h:1 fmt:yuv422p10le sar:10/11 ->
w:720 h:1 fmt:gray sar:10/11 flags:0x0
[auto_scale_0 @ 0x7fa44e901080] w:720 h:1 fmt:yuv422p10le sar:10/11 ->
w:720 h:1 fmt:gray sar:10/11 flags:0x0
[auto_scale_0 @ 0x7fa44e901080] w:720 h:1 fmt:yuv422p10le sar:10/11 ->
w:720 h:1 fmt:gray sar:10/11 flags:0x0
Output #0, rawvideo, to
'/Users/useraccount/Desktop/Sample/BTA003-05.line21':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf59.20.101
Stream #0:0(eng), 0, 100/2997: Video: rawvideo (Y800 / 0x30303859),
gray(pc, smpte170m/unknown/unknown, progressive), 720x1 [SAR 10:11 DAR
7200:11], q=2-31, 172 kb/s, 29.97 fps, 29.97 tbn (default)
Metadata:
handler_name : Apple Video Media Handler
vendor_id : FFMP
encoder : Lavc59.25.100 rawvideo
Clipping frame in rate conversion by 0.000008
frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A
speed= 0x
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless
if it occurs once at the start per stream)
[out_0_0 @ 0x7fa44e9008c0] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
frame= 60 fps=0.0 q=-0.0 Lsize= 42kB time=00:00:02.00 bitrate=
172.6kbits/s speed=48.8x
video:42kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000000%
Input file #0 (/Users/useraccount/Desktop/Sample/BTA003-05.mov):
Input stream #0:0 (video): 61 packets read (6472080 bytes); 60 frames
decoded;
Input stream #0:1 (audio): 1 packets read (3072 bytes);
Total: 62 packets (6475152 bytes) demuxed
Output file #0 (/Users/useraccount/Desktop/Sample/BTA003-05.line21):
Output stream #0:0 (video): 60 frames encoded; 60 packets muxed (43200
bytes);
Total: 60 packets (43200 bytes) muxed
[AVIOContext @ 0x7fa44cd06000] Statistics: 43200 bytes written, 0 seeks, 1
writeouts
60 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7fa44cd00e00] Statistics: 6799419 bytes read, 2 seeks
}}}
Patches should be submitted to the ffmpeg-devel mailing list and not this
bug tracker.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9712>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list