Opened 6 years ago

Last modified 4 years ago

#1304 reopened defect

rawvideo 8bpp: incorrect output with -vcodec copy

Reported by: ami_stuff Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: pal8
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes


the output file is unplayable (black screen)

C:\>ffmpeg -i None_8bpp.avi -vcodec copy out.avi
ffmpeg version N-40622-g1caf614 Copyright (c) 2000-2012 the FFmpeg developers
  built on May 13 2012 02:22:21 with gcc 4.5.0 20100414 (Fedora MinGW 4.5.0-1.fc
  configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch=
x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min
gw32-gcc' --enable-w32threads --enable-memalign-hack --enable-runtime-cpudetect
--enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 -
lwinmm' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snapshots/buil
d/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/snapshots/b
uild/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --enable-n
onfree --enable-libx264 --enable-libspeex --enable-libtheora --enable-libvorbis
--enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable-libopencor
e-amrwb --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx
  libavutil      51. 50.100 / 51. 50.100
  libavcodec     54. 21.101 / 54. 21.101
  libavformat    54.  4.100 / 54.  4.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.105 /  2. 72.105
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'None_8bpp.avi':
  Duration: 00:00:05.96, start: 0.000000, bitrate: 4883 kb/s
    Stream #0:0: Video: rawvideo, pal8, 189x127, 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'out.avi':
    ISFT            : Lavf54.4.100
    Stream #0:0: Video: rawvideo, pal8, 189x127, q=2-31, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  149 fps=0.0 q=-1.0 Lsize=    3559kB time=00:00:05.96 bitrate=4892.0kbits
video:3549kB audio:0kB global headers:0kB muxing overhead 0.283222%

Attachments (2)

None_8bpp.rar (926.4 KB) - added by ami_stuff 6 years ago.
remuxed_fix.jpg (202.3 KB) - added by ami_stuff 4 years ago.

Download all attachments as: .zip

Change History (13)

Changed 6 years ago by ami_stuff

comment:1 Changed 6 years ago by cehoyos

  • Keywords palette added
  • Version changed from unspecified to git-master

comment:2 Changed 6 years ago by cehoyos

  • Keywords pal8 added; palette removed

comment:3 Changed 4 years ago by kurosu

  • Analyzed by developer set
  • Component changed from undetermined to avformat
  • Reproduced by developer set

The issue is that avienc.c never writes the palette.

avidec.c stores it as packet side data, and my attempts at retrieving it failed when it is needed (avienc.c, line 336). I have no idea how to store it as stream side data, and other attempts yielded nothing too.

comment:4 Changed 4 years ago by benoit

Actually, the palette is written, as it is part of the extradata. The issue is that it's not written at the end of the extradata, as the demuxer expects it, because of the BottomUp field present in the extradata too.
A patch fixing the playback (so fixing the demuxer) has been pushed to git (9c843fb1d0810626194a789eb24a2af404f3be2c)

comment:5 Changed 4 years ago by cehoyos

The issue is still reproducible with 9f0ba52f - WMP does play the input file but refuses to play the output file.

comment:6 Changed 4 years ago by michael

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

comment:7 Changed 4 years ago by cehoyos

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:8 Changed 4 years ago by benoit

I tried to not use 'copy' as a codec, but it also fails to play (ffplay has wrong display and WMP just refuses to open the file).
I also tried to create a non odd sized video , but WMP refuses to play it as well (using ffmpeg -f lavfi -t 5 -i testsrc -c:v rawvideo -pix_fmt pal8 -y out.avi) whereas it's OK for ffplay.
I'll try to dig a bit more to see what's different between None_8bpp.avi and the file we generate.

comment:9 Changed 4 years ago by cehoyos

The relevant difference is not DIB (at least not alone), that is what I tested yesterday.

comment:10 Changed 4 years ago by ami_stuff

see attached screenshot, some values should be zero'ed to make wmp happy

Changed 4 years ago by ami_stuff

comment:11 Changed 4 years ago by cehoyos

Thank you for the debugging!

Thee are two independent issues:
The palette is not part of the bitmapinfoheader but the bitmapinfoheader and the palette form the bitmapinfo structure, so the size of the palette must not be added to the size of the bitmapinfoheader. I sent a patch.
The other issue is that the frame size is incorrectly written as 189x127 but the actual size of one frame is 192x127. Size 0 is allowed for rawvideo.

Note: See TracTickets for help on using tickets.