Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#7880 closed defect (fixed)

Video codec qtrle inputs are truncated in output

Reported by: Acru Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: qtrle regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

When transcoding with a mov/qtrle video as the source (one of the few formats supporting alpha channel), frames are being lost from the end of the output, notably if the last frame is blank and repeats but possibly in other cases too.

This issue seems to have appeared between release 4.0.2 and 4.1, and persists to at least build 20190505-e384f6f.

Tested with windows 32/64-bit static builds.

How to reproduce:

Create a video from a few identical blank pngs; (eg. 256x256 white, 8 frames)
ffmpeg -framerate 1 -i Test\%04d.png -c:v qtrle -y TestIn.mov
Transcode into any other format;
ffmpeg -i TestIn.mov -c:v qtrle -y TestOut.mov

Check resulting frame counts; (Or check video duration)
ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 TestIn.mov
ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 TestOut.mov

Log:

>ffmpeg -framerate 1 -i Test\%04d.png -c:v qtrle -y TestIn.mov
ffmpeg version N-93762-ge384f6f2f9 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 52.100 / 58. 52.100
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 50.100 /  7. 50.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, image2, from 'Test\%04d.png':
  Duration: 00:00:08.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 256x256 [SAR 3780:3780 DAR 1:1], 1 fps, 1 tbr, 1 tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> qtrle (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'TestIn.mov':
  Metadata:
    encoder         : Lavf58.27.103
    Stream #0:0: Video: qtrle (rle  / 0x20656C72), argb, 256x256 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 1 fps, 16384 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.52.100 qtrle
frame=    8 fps=0.0 q=-0.0 Lsize=       4kB time=00:00:07.00 bitrate=   4.5kbits/s speed= 778x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 25.383633%

>ffmpeg -i TestIn.mov -c:v qtrle -y TestOut.mov
ffmpeg version N-93762-ge384f6f2f9 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 52.100 / 58. 52.100
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 50.100 /  7. 50.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'TestIn.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.27.103
  Duration: 00:00:08.00, start: 0.000000, bitrate: 3 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), argb(progressive), 256x256, 3 kb/s, SAR 1:1 DAR 1:1, 1 fps, 1 tbr, 16384 tbn, 16384 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.52.100 qtrle
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle (native) -> qtrle (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'TestOut.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.27.103
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), argb, 256x256 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 1 fps, 16384 tbn, 1 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.52.100 qtrle
frame=    1 fps=0.0 q=-0.0 Lsize=       4kB time=00:00:00.00 bitrate=501114.8kbits/s speed=0.00762x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 24.098734%

>ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 TestIn.mov
8

>ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 TestOut.mov
1

Leave a note if you find a workaround, reverted to ffmpeg version 4.0.2 in the mean time.

Change History (7)

comment:1 by Elon Musk, 6 years ago

This is caused by one of fixes by Michael.
Any duplicate frame is simply dropped.

comment:2 by Elon Musk, 6 years ago

Try to use -vsync cfr as input option.

comment:3 by Carl Eugen Hoyos, 6 years ago

Keywords: regression added; duration removed
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: 4.1git-master

in reply to:  2 comment:4 by Acru, 6 years ago

Replying to richardpl:

Try to use -vsync cfr as input option.

I tried -vsync with 0 1 and 2, as input option (and output just to be sure), though no effect.

comment:5 by Carl Eugen Hoyos, 6 years ago

Of course, there would be no issue if that worked.

comment:6 by James, 5 years ago

Resolution: fixed
Status: openclosed

comment:7 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegavcodec
Note: See TracTickets for help on using tickets.