Opened 12 years ago

Last modified 3 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

Description

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
14)
  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':
  Metadata:
    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
/s
video:3549kB audio:0kB global headers:0kB muxing overhead 0.283222%

Attachments (2)

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

Download all attachments as: .zip

Change History (16)

by ami_stuff, 12 years ago

Attachment: None_8bpp.rar added

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: palette added
Version: unspecifiedgit-master

comment:2 by Carl Eugen Hoyos, 12 years ago

Keywords: pal8 added; palette removed

comment:3 by Christophe, 10 years ago

Analyzed by developer: set
Component: undeterminedavformat
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 by Benoit Fouet, 9 years ago

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 by Carl Eugen Hoyos, 9 years ago

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

comment:6 by Michael Niedermayer, 9 years ago

Resolution: fixed
Status: newclosed

comment:7 by Carl Eugen Hoyos, 9 years ago

Resolution: fixed
Status: closedreopened

comment:8 by Benoit Fouet, 9 years ago

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 by Carl Eugen Hoyos, 9 years ago

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

comment:10 by ami_stuff, 9 years ago

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

by ami_stuff, 9 years ago

Attachment: remuxed_fix.jpg added

comment:11 by Carl Eugen Hoyos, 9 years ago

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.

comment:12 by vivekyadav, 3 years ago

Resolution: worksforme
Status: reopenedclosed

comment:13 by Carl Eugen Hoyos, 3 years ago

This issue is definitely still reproducible, I don't know if ticket #6832 ever described a valid issue but I will also reopen it.

comment:14 by Carl Eugen Hoyos, 3 years ago

Resolution: worksforme
Status: closedreopened
Note: See TracTickets for help on using tickets.