Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image processing 如何从无损x264视频中提取16位PNG帧_Image Processing_Video_Ffmpeg_X264_Lossless - Fatal编程技术网

Image processing 如何从无损x264视频中提取16位PNG帧

Image processing 如何从无损x264视频中提取16位PNG帧,image-processing,video,ffmpeg,x264,lossless,Image Processing,Video,Ffmpeg,X264,Lossless,我使用以下命令将一系列16位灰度PNG编码为无损视频: ffmpeg -i image%04d.png -crf 0 -c:v libx264 -preset veryslow output.mp4 我现在正试图通过以相同的质量拔出PNG来验证转换为视频是否真的是无损的。我正在使用的命令: ffmpeg -i output.mp4 image%04d.png 然而,这是输出8位PNG。我已经尝试了我读过的各种选项,比如-vcodec png和-qscale 0,但到目前为止,似乎没有任何东西

我使用以下命令将一系列16位灰度PNG编码为无损视频:

ffmpeg -i image%04d.png -crf 0 -c:v libx264 -preset veryslow output.mp4
我现在正试图通过以相同的质量拔出PNG来验证转换为视频是否真的是无损的。我正在使用的命令:

ffmpeg -i output.mp4 image%04d.png
然而,这是输出8位PNG。我已经尝试了我读过的各种选项,比如-vcodec png和-qscale 0,但到目前为止,似乎没有任何东西可以使它输出16位png

我如何从视频中提取所有帧,使其质量与视频中的相同?还是我当初在制作无损视频时犯了错误

编辑:我在尝试使用-pix_fmt gray16be时收到此错误消息

[swscaler@0x7fef1a8f0800]使用了不推荐的像素格式,请确保 你设置的范围正确吗

全输出:

ffmpeg -i output.mp4 -pix_fmt gray16be  image%04d.png
ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.71.100
  Duration: 00:00:09.76, start: 0.000000, bitrate: 1337 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuvj444p(pc), 512x512, 1336 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
[swscaler @ 0x7fef1a8f0800] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'image%04d.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.71.100
    Stream #0:0(und): Video: png, gray16be, 512x512, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.89.100 png
frame=  244 fps=0.0 q=-0.0 Lsize=N/A time=00:00:09.76 bitrate=N/A speed=  21x    
video:4038kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

如果有非ffmpeg解决方案的话,我很乐意使用。

您的无损视频是8位的,因为x264就是这样编码的。在任何情况下,x264都不会超过10位,因为您需要一个独立的编码器或不同的ffmpeg二进制文件

-c:v ffv1是无损的,可以编码为16位灰度16LE或16位RGB,例如rgb48le

swscaler行是一个警告,而不是一个错误。FFmpeg将输出报告为每个通道16位

Stream #0:0(und): Video: png, gray16be, 512x512 ...
但当您编码到H.264时,由于位深度的降低,您已经失去了保真度

我不清楚输入PNG的像素格式是什么-没有色调提示的RGB,还是单通道编码?我怀疑前者,在这种情况下,使用

ffmpeg -i image%04d.png -c:v ffv1 output.nut
然后你可以做一个比较

ffmpeg -i output.nut -i image%04d.png -filter_complex ssim -f null -
读数

SSIM R:1.000000 (inf) G:1.000000 (inf) B:1.000000 (inf) All:1.000000 (inf)
表示完全保真度