[Libav-user] [help][ffmpeg]Compress png picture failed:Invalid PNG signature 0x00000000

baijundong baijundong at neusoft.com
Mon Jan 22 13:15:39 EET 2018

Hello every one

I user ffmpeg API for Compressing png picture failed: [Invalid PNG signature
There is no output file.please help me~Thank you very much!

Soft environment:
Ubuntu: 14.04

2、Problem Description:
1) The base code is Version 3.0.2 FFmpeg's source:
doc/example/transcoding.c. I modify the coding for compress the src picture
to 320X240:
transcoding.c :: static int open_output_file(const char *filename):127~128
enc_ctx->height = 240;
enc_ctx->width = 320;

2) transcoding.c :: static int init_filters(void):354 step。Set scale is
 filter_spec = "scale=320:240";

3) Compile and run:'/transcoding /home/neusoft/baijd/scale_test/6.png
   No output file be created.
   Note that:compressing jpeg file or jpg file no problem.

4) the attachment of email is the source code.
[file @ 0x7e3670] Setting default whitelist 'file,crypto'
Probing image2 score:50 size:2048
Probing png_pipe score:99 size:2048
[png_pipe @ 0x7e3010] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0x7e3010] Before avformat_find_stream_info() pos: 0 bytes
read:32768 seeks:0
[png_pipe @ 0x7e3010] 0: start_time: -9223372036854.775 duration:
[png_pipe @ 0x7e3010] stream: start_time: -9223372036854.775 duration:
-9223372036854.775 bitrate=0 kb/s
[png_pipe @ 0x7e3010] After avformat_find_stream_info() pos: 382026 bytes
read:382026 seeks:0 frames:2
detected 4 logical cores
Input #0, png_pipe, from '/home/neusoft/baijd/scale_test/6.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 2, 1/25: Video: png, 1 reference frame, rgba(pc), 580x820
[SAR 2835:2835 DAR 29:41], 1/25, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to '/home/neusoft/baijd/scale_test/62-output.png':
    Stream #0:0, 0, 0/0: Video: png, 1 reference frame, rgb24, 320x240 [SAR
2835:2835 DAR 4:3], 1/25, q=2-31, 128 kb/s, 25 tbc
[image2 @ 0x7f3e20] Using AVStream.codec.time_base as a timebase hint to the
muxer is deprecated. Set AVStream.time_base instead.
[in @ 0x83a3a0] Setting 'video_size' to value '580x820'
[in @ 0x83a3a0] Setting 'pix_fmt' to value '28'
[in @ 0x83a3a0] Setting 'time_base' to value '1/25'
[in @ 0x83a3a0] Setting 'pixel_aspect' to value '2835/2835'
[in @ 0x83a3a0] w:580 h:820 pixfmt:rgba tb:1/25 fr:0/1 sar:2835/2835
[Parsed_scale_0 @ 0x83aa30] Setting 'w' to value '320'
[Parsed_scale_0 @ 0x83aa30] Setting 'h' to value '240'
[Parsed_scale_0 @ 0x83aa30] w:320 h:240 flags:'bilinear' interl:0
[AVFilterGraph @ 0x839c60] query_formats: 3 queried, 2 merged, 0 already
done, 0 delayed
[swscaler @ 0x83afb0] Forcing full internal H chroma due to input having non
subsampled chroma
[Parsed_scale_0 @ 0x83aa30] w:580 h:820 fmt:rgba sar:2835/2835 -> w:320
h:240 fmt:rgb24 sar:87/164 flags:0x2
Demuxer gave frame of stream_index 0
Going to reencode&filter the frame
Demuxer gave frame of stream_index 0
Going to reencode&filter the frame
Pushing decoded frame to filters
Pulling filtered frame from filters
[png @ 0x7ea4e0] Invalid PNG signature 0x00000000.
[AVIOContext @ 0x7eb770] Statistics: 382026 bytes read, 0 seeks

Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s)
is intended only for the use of the intended recipient and may be confidential and/or privileged of
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying
is strictly prohibited, and may be unlawful.If you have received this communication in error,please
immediately notify the sender by return e-mail, and delete the original message and all copies from
your system. Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transcoding.c
Type: application/octet-stream
Size: 20478 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180122/d0ae8e05/attachment.obj>

More information about the Libav-user mailing list