Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#511 closed defect (fixed)

Intel JPEG library: flipped?

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: mjpeg Debian roundup
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Since r20312, FFmpeg flips jpeg if the comment in the encoded stream contains "Intel(R) JPEG Library", see attached samples inteljpeg.avi (issue 1464) and midvidjpeg.avi (issue 1468).

Attached Bad_1.jpg (Debian #625944) also contains the string, but should not be flipped.

$ ffmpeg -v 9 -loglevel 99 -i Bad_1.jpg
ffmpeg version N-32933-g9b3df9b, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 26 2011 01:22:40 with gcc 4.5.3
  configuration: --cc='/usr/local/gcc-4.5.3/bin/gcc -m32'
  libavutil    51. 17. 0 / 51. 17. 0
  libavcodec   53. 17. 0 / 53. 17. 0
  libavformat  53. 13. 0 / 53. 13. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 5 /  2. 43. 5
  libswscale    2.  1. 0 /  2.  1. 0
[mjpeg @ 0x8cbf0e0] Unsupported bit depth: 0
[mjpeg @ 0x8cbf0e0] buffer too small, expanding to 10519 bytes
[mjpeg @ 0x8cbf0e0] marker=d8 avail_size_in_buf=10519
[mjpeg @ 0x8cbf0e0] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x8cbf0e0] marker=e0 avail_size_in_buf=10517
[mjpeg @ 0x8cbf0e0] marker parser used 16 bytes (128 bits)
[mjpeg @ 0x8cbf0e0] marker=fe avail_size_in_buf=10499
[mjpeg @ 0x8cbf0e0] marker parser used 46 bytes (368 bits)
[mjpeg @ 0x8cbf0e0] marker=db avail_size_in_buf=10451
[mjpeg @ 0x8cbf0e0] index=0
[mjpeg @ 0x8cbf0e0] qscale[0]: 3
[mjpeg @ 0x8cbf0e0] marker parser used 67 bytes (536 bits)
[mjpeg @ 0x8cbf0e0] marker=db avail_size_in_buf=10382
[mjpeg @ 0x8cbf0e0] index=1
[mjpeg @ 0x8cbf0e0] qscale[1]: 6
[mjpeg @ 0x8cbf0e0] marker parser used 67 bytes (536 bits)
[mjpeg @ 0x8cbf0e0] marker=c4 avail_size_in_buf=10313
[mjpeg @ 0x8cbf0e0] class=0 index=0 nb_codes=12
[mjpeg @ 0x8cbf0e0] class=1 index=0 nb_codes=251
[mjpeg @ 0x8cbf0e0] class=0 index=1 nb_codes=12
[mjpeg @ 0x8cbf0e0] class=1 index=1 nb_codes=251
[mjpeg @ 0x8cbf0e0] marker parser used 418 bytes (3344 bits)
[mjpeg @ 0x8cbf0e0] marker=c0 avail_size_in_buf=9893
[mjpeg @ 0x8cbf0e0] sof0: picture: 300x300
[mjpeg @ 0x8cbf0e0] component 0 2:2 id: 0 quant:0
[mjpeg @ 0x8cbf0e0] component 1 1:1 id: 1 quant:1
[mjpeg @ 0x8cbf0e0] component 2 1:1 id: 2 quant:1
[mjpeg @ 0x8cbf0e0] pix fmt id 22111100
[mjpeg @ 0x8cbf0e0] marker parser used 17 bytes (136 bits)
[mjpeg @ 0x8cbf0e0] escaping removed 255 bytes
[mjpeg @ 0x8cbf0e0] marker=da avail_size_in_buf=9874
[mjpeg @ 0x8cbf0e0] component: 0
[mjpeg @ 0x8cbf0e0] component: 1
[mjpeg @ 0x8cbf0e0] component: 2
[mjpeg @ 0x8cbf0e0] marker parser used 9618 bytes (76938 bits)
[mjpeg @ 0x8cbf0e0] marker=d9 avail_size_in_buf=0
[mjpeg @ 0x8cbf0e0] mjpeg decode frame unused 0 bytes
Input #0, image2, from 'Bad_1.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: mjpeg, yuvj420p, 300x300 [SAR 1:1 DAR 1:1], 1/25, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified

Attachments (3)

inteljpeg.avi (1.7 MB ) - added by Carl Eugen Hoyos 13 years ago.
midvidjpeg.avi (1.2 MB ) - added by Carl Eugen Hoyos 13 years ago.
Bad_1.jpg (10.3 KB ) - added by Carl Eugen Hoyos 13 years ago.

Change History (8)

by Carl Eugen Hoyos, 13 years ago

Attachment: inteljpeg.avi added

by Carl Eugen Hoyos, 13 years ago

Attachment: midvidjpeg.avi added

by Carl Eugen Hoyos, 13 years ago

Attachment: Bad_1.jpg added

comment:1 by Carl Eugen Hoyos, 13 years ago

Keywords: mjpeg added

comment:2 by ami_stuff, 13 years ago

In this case the file is flipped unnecessary.

libavcodec/mjpegdec.c:

            else if((len > 20 && !strncmp(cbuf, "Intel(R) JPEG Library", 21)) ||
                    (len > 19 && !strncmp(cbuf, "Metasoft MJPEG Codec", 20))){
-                s->flipped = 1;
+                s->flipped = 0;
            }

so it looks like the intel jpeg encoder can save flipped and not flipped jpeg frames and the question is how to identify which frames should be fliped and which not.

Version 0, edited 13 years ago by ami_stuff (next)

comment:3 by Michael Niedermayer, 12 years ago

Resolution: fixed
Status: newclosed

comment:4 by Carl Eugen Hoyos, 12 years ago

Keywords: Debian added

comment:5 by Carl Eugen Hoyos, 12 years ago

Keywords: roundup added
Note: See TracTickets for help on using tickets.