[FFmpeg-trac] #9787(ffmpeg:new): The movie filter fails to preserve SAR for png resource

FFmpeg trac at avcodec.org
Fri May 20 06:30:49 EEST 2022


#9787: The movie filter fails to preserve SAR for png resource
-------------------------------------+-------------------------------------
             Reporter:  Arnon        |                     Type:  defect
               Status:  new          |                 Priority:  minor
            Component:  ffmpeg       |                  Version:
             Keywords:  movie        |               Blocked By:
  filter png sar                     |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Encoding a png image using a lossless codec, and then extracting the frame
 back out, the resulting image is identical to the source, as expected:

 {{{
 ffmpeg -i 000001.png -c:v libx264rgb -crf 0 test.image1.mp4
 ffmpeg -i test.image1.mp4 t.1+%06d.png
 cmp 000001.png t.1+000001.png
 }}}

 Using the (I believe) equivalent command with a movie filter input, the
 extracted image differs from the source, unexpectedly:

 {{{
 ffmpeg -filter_complex movie=000001.png -c:v libx264rgb -crf 0
 test.image2.mp4
 ffmpeg -i test.image2.mp4 t.2+%06d.png
 cmp 000001.png t.2+000001.png
 000001.png t.2+000001.png differ: byte 45, line 3
 }}}

 A hint comes from showinfo.  This is the input:

 {{{
 [Parsed_showinfo_5 @ 0x55cd65f862c0] n:   0 pts:      0 pts_time:0
 pos:        0 fmt:rgb24 sar:12/11 s:176x144 i:P iskey:1 type:I
 checksum:9E034500 plane_checksum:[9E034500] mean:[119] stdev:[67.4]
 }}}

 And this is the output:

 {{{
 [Parsed_showinfo_0 @ 0x5556aa2eb5c0] n:   0 pts:      0 pts_time:0
 pos:       48 fmt:gbrp sar:1/1 s:176x144 i:P iskey:1 type:I
 checksum:CA0C4500 plane_checksum:[DE18A2C2 94056061 390141CE] mean:[118
 120 120] stdev:[68.0 68.0 66.1]
 }}}

 So it looks like SAR is not preserved.  This is confirmed by ffprobe, and
 indeed, setting SAR explicitly solves the problem:

 {{{
 ffmpeg -filter_complex "movie=000001.png,setsar=12/11" -c:v libx264rgb
 -crf 0 test.image3.mp4
 ffmpeg -i test.image3.mp4 t.3+%06d.png
 cmp 000001.png t.3+000001.png
 }}}

 I can reproduce this with ffmpeg 3.4.9 and ffmpeg 4.4.2.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9787>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list