#11649: -noautorotate -display_rotation 0 passes through rotation metadata with JPEG inputs -------------------------------------+------------------------------------- Reporter: Wes Castro | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: unspecified | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Description changed by Wes Castro:
Old description: > Summary of the bug: > When invoking FFmpeg with a JPEG input that contains `Orientation` EXIF > metadata tag and `-noautorotate -display_rotation 0` with an MP4 output, > the output will have a display_matrix indicating a rotation starting with > FFmpeg 7.1. It is expected that the output will not be physically rotated > and not contain any display_matrix. > > How to reproduce: > Use attached test file (1920x1080 JPEG image with Orientation=6 in EXIF > metadata (rotated 90 degs CCW) > {{{ > ffmpeg -noautorotate -display_rotation 0 -i test_image_rotated.jpg > output.mp4 > }}} > > FFprobe of output produced by FFmpeg 7.0: > {{{ > ffprobe version n7.0 Copyright (c) 2007-2024 the FFmpeg developers > built with gcc 11 (GCC) > configuration: --enable-gpl > libavutil 59. 8.100 / 59. 8.100 > libavcodec 61. 3.100 / 61. 3.100 > libavformat 61. 1.100 / 61. 1.100 > libavdevice 61. 1.100 / 61. 1.100 > libavfilter 10. 1.100 / 10. 1.100 > libswscale 8. 1.100 / 8. 1.100 > libswresample 5. 1.100 / 5. 1.100 > libpostproc 58. 1.100 / 58. 1.100 > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/wescastro/out.mp4': > Metadata: > major_brand : isom > minor_version : 512 > compatible_brands: isomiso2mp41 > encoder : Lavf61.1.100 > Duration: 00:00:00.04, start: 0.000000, bitrate: 8507 kb/s > Stream #0:0[0x1](und): Video: mpeg4 (Simple Profile) (mp4v / > 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 8335 kb/s, 25 fps, 25 > tbr, 12800 tbn (default) > Metadata: > handler_name : VideoHandler > vendor_id : [0][0][0][0] > encoder : Lavc61.3.100 mpeg4 > }}} > > FFprobe of output produced by FFmpeg 7.1 > {{{ > ffprobe version n7.1 Copyright (c) 2007-2024 the FFmpeg developers > built with gcc 11 (GCC) > configuration: --enable-gpl > libavutil 59. 39.100 / 59. 39.100 > libavcodec 61. 19.100 / 61. 19.100 > libavformat 61. 7.100 / 61. 7.100 > libavdevice 61. 3.100 / 61. 3.100 > libavfilter 10. 4.100 / 10. 4.100 > libswscale 8. 3.100 / 8. 3.100 > libswresample 5. 3.100 / 5. 3.100 > libpostproc 58. 3.100 / 58. 3.100 > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/wescastro/out.mp4': > Metadata: > major_brand : isom > minor_version : 512 > compatible_brands: isomiso2mp41 > encoder : Lavf61.7.100 > Duration: 00:00:00.04, start: 0.000000, bitrate: 9138 kb/s > Stream #0:0[0x1](und): Video: mpeg4 (Simple Profile) (mp4v / > 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 8335 kb/s, 25 fps, 25 > tbr, 12800 tbn (default) > Metadata: > handler_name : VideoHandler > vendor_id : [0][0][0][0] > encoder : Lavc61.19.100 mpeg4 > Side data: > ICC Profile > displaymatrix: rotation of -90.00 degrees > }}} > > FFmpeg 7.1.1 and 7.2-dev produce the same output with `displaymatrix: > rotation of -90.00 degrees`. On the master branch > (5b1301004bdade13e3fee22081459e339ddd2637) the command line is completely > broken and exits with a failure: > {{{ > ffmpeg version N-120020-g5b1301004b Copyright (c) 2000-2025 the FFmpeg > developers > built with gcc 11 (GCC) > configuration: --enable-gpl > libavutil 60. 3.100 / 60. 3.100 > libavcodec 62. 4.100 / 62. 4.100 > libavformat 62. 1.100 / 62. 1.100 > libavdevice 62. 0.100 / 62. 0.100 > libavfilter 11. 0.100 / 11. 0.100 > libswscale 9. 0.100 / 9. 0.100 > libswresample 6. 0.100 / 6. 0.100 > Input #0, image2, from 'test_image_rotated.jpg': > Duration: 00:00:00.04, start: 0.000000, bitrate: 9414 kb/s > Stream #0:0: Video: mjpeg (Progressive), yuvj444p(pc, > bt470bg/unknown/unknown), 1920x1080, 25 fps, 25 tbr, 25 tbn > Side data: > displaymatrix: rotation of -0.00 degrees > Stream mapping: > Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) > Press [q] to stop, [?] for help > [vf#0:0 @ 0x300b080] Task finished with error code: -17 (File exists) > [vf#0:0 @ 0x300b080] Terminating thread with return code -17 (File > exists) > [vost#0:0/mpeg4 @ 0x300ddc0] [enc:mpeg4 @ 0x300e7c0] Could not open > encoder before EOF > [vost#0:0/mpeg4 @ 0x300ddc0] Task finished with error code: -22 (Invalid > argument) > [vost#0:0/mpeg4 @ 0x300ddc0] Terminating thread with return code -22 > (Invalid argument) > [out#0/mp4 @ 0x3007840] Nothing was written into output file, because at > least one of its streams received no packets. > frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A > speed=N/A elapsed=0:00:00.01 > Conversion failed! > }}} New description: Summary of the bug: When invoking FFmpeg with `-noautorotate -display_rotation 0` using a JPEG input that contains `Orientation` EXIF metadata tag written to an MP4 output, the output will have a display_matrix indicating a rotation starting with FFmpeg 7.1. It is expected that the output will not be physically rotated and not contain any display_matrix. The issue doesn't occur with FFmpeg 7.0 where the output correctly doesn't have a display_matrix How to reproduce: Use attached test file (1920x1080 JPEG image with Orientation=6 in EXIF metadata (rotated 90 degs CCW) {{{ ffmpeg -noautorotate -display_rotation 0 -i test_image_rotated.jpg output.mp4 }}} FFprobe of output produced by FFmpeg 7.0: {{{ ffprobe version n7.0 Copyright (c) 2007-2024 the FFmpeg developers built with gcc 11 (GCC) configuration: --enable-gpl libavutil 59. 8.100 / 59. 8.100 libavcodec 61. 3.100 / 61. 3.100 libavformat 61. 1.100 / 61. 1.100 libavdevice 61. 1.100 / 61. 1.100 libavfilter 10. 1.100 / 10. 1.100 libswscale 8. 1.100 / 8. 1.100 libswresample 5. 1.100 / 5. 1.100 libpostproc 58. 1.100 / 58. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/wescastro/out.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf61.1.100 Duration: 00:00:00.04, start: 0.000000, bitrate: 8507 kb/s Stream #0:0[0x1](und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 8335 kb/s, 25 fps, 25 tbr, 12800 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.3.100 mpeg4 }}} FFprobe of output produced by FFmpeg 7.1 {{{ ffprobe version n7.1 Copyright (c) 2007-2024 the FFmpeg developers built with gcc 11 (GCC) configuration: --enable-gpl libavutil 59. 39.100 / 59. 39.100 libavcodec 61. 19.100 / 61. 19.100 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/wescastro/out.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf61.7.100 Duration: 00:00:00.04, start: 0.000000, bitrate: 9138 kb/s Stream #0:0[0x1](und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 8335 kb/s, 25 fps, 25 tbr, 12800 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.100 mpeg4 Side data: ICC Profile displaymatrix: rotation of -90.00 degrees }}} FFmpeg 7.1.1 and 7.2-dev produce the same output with `displaymatrix: rotation of -90.00 degrees`. On the master branch (5b1301004bdade13e3fee22081459e339ddd2637) the command line is completely broken and exits with a failure: {{{ ffmpeg version N-120020-g5b1301004b Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (GCC) configuration: --enable-gpl libavutil 60. 3.100 / 60. 3.100 libavcodec 62. 4.100 / 62. 4.100 libavformat 62. 1.100 / 62. 1.100 libavdevice 62. 0.100 / 62. 0.100 libavfilter 11. 0.100 / 11. 0.100 libswscale 9. 0.100 / 9. 0.100 libswresample 6. 0.100 / 6. 0.100 Input #0, image2, from 'test_image_rotated.jpg': Duration: 00:00:00.04, start: 0.000000, bitrate: 9414 kb/s Stream #0:0: Video: mjpeg (Progressive), yuvj444p(pc, bt470bg/unknown/unknown), 1920x1080, 25 fps, 25 tbr, 25 tbn Side data: displaymatrix: rotation of -0.00 degrees Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [vf#0:0 @ 0x300b080] Task finished with error code: -17 (File exists) [vf#0:0 @ 0x300b080] Terminating thread with return code -17 (File exists) [vost#0:0/mpeg4 @ 0x300ddc0] [enc:mpeg4 @ 0x300e7c0] Could not open encoder before EOF [vost#0:0/mpeg4 @ 0x300ddc0] Task finished with error code: -22 (Invalid argument) [vost#0:0/mpeg4 @ 0x300ddc0] Terminating thread with return code -22 (Invalid argument) [out#0/mp4 @ 0x3007840] Nothing was written into output file, because at least one of its streams received no packets. frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A elapsed=0:00:00.01 Conversion failed! }}} -- -- Ticket URL: <https://trac.ffmpeg.org/ticket/11649#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
_______________________________________________ FFmpeg-trac mailing list FFmpeg-trac@avcodec.org https://ffmpeg.org/mailman/listinfo/ffmpeg-trac To unsubscribe, visit link above, or email ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".