baijd_ss 2018-01-22 11:25 采纳率: 0%
浏览 2819
已结题

使用ffmpeg API 进行png格式图片压缩失败:Invalid PNG signature

问题概要描述:利用ffmpeg进行png图片压缩失败。

软件环境:
ffmpeg的版本:3.0.2
操作系统:ubuntu14.04

问题详细:
1、基于ffmpeg 源码中doc/example/transcoding.c进行了修改:png图片压缩为320X240。
open_output_file():127~128行

enc_ctx->height = 240;
enc_ctx->width = 320;

2、init_filters():354行:

 filter_spec = "scale=320:240";

3、编译OK之后,利用ffmpeg进行png图片压缩时报错:
[png @ 0x1bcd4e0] Invalid PNG signature 0x00000000.
详细如下:

[file @ 0x1bc6670] Setting default whitelist 'file,crypto'
Probing image2 score:50 size:2048
Probing png_pipe score:99 size:2048
[png_pipe @ 0x1bc6010] Format png_pipe probed with size=2048 and score=99
[png_pipe @ 0x1bc6010] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
[png_pipe @ 0x1bc6010] 0: start_time: -9223372036854.775 duration: -9223372036854.775
[png_pipe @ 0x1bc6010] stream: start_time: -9223372036854.775 duration: -9223372036854.775 bitrate=0 kb/s
[png_pipe @ 0x1bc6010] 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 @ 0x1bd6e20] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
[in @ 0x1c1d3a0] Setting 'video_size' to value '580x820'
[in @ 0x1c1d3a0] Setting 'pix_fmt' to value '28'
[in @ 0x1c1d3a0] Setting 'time_base' to value '1/25'
[in @ 0x1c1d3a0] Setting 'pixel_aspect' to value '2835/2835'
[in @ 0x1c1d3a0] w:580 h:820 pixfmt:rgba tb:1/25 fr:0/1 sar:2835/2835 sws_param:
[Parsed_scale_0 @ 0x1c1da30] Setting 'w' to value '320'
[Parsed_scale_0 @ 0x1c1da30] Setting 'h' to value '240'
[Parsed_scale_0 @ 0x1c1da30] w:320 h:240 flags:'bilinear' interl:0
[AVFilterGraph @ 0x1c1cc60] query_formats: 3 queried, 2 merged, 0 already done, 0 delayed
[swscaler @ 0x1c1dfb0] Forcing full internal H chroma due to input having non subsampled chroma
[Parsed_scale_0 @ 0x1c1da30] 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 @ 0x1bcd4e0] Invalid PNG signature 0x00000000.
[AVIOContext @ 0x1bce770] Statistics: 382026 bytes read, 0 seeks

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)