如何使用 avconv 将 ppm 转换为 mp4

How to convert ppm to mp4 with avconv

我正在尝试将 video.ppm 转换为 video.mp4。

我试过了:

avconv -r 1 -i Hole0.0001.mp4.ppm -r 24 Hole.mp4

avconv version 12.3, Copyright (c) 2000-2018 the Libav developers
  built on Oct  2 2019 11:39:18 with gcc 8 (GCC)
Input #0, image2, from 'Hole0.0001.mp4.ppm':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: ppm
      rgb24, 1310x560
      25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (ppm (native) -> mpeg4 (native))
Press ctrl-c to stop encoding
Output #0, mp4, to 'Hole.mp4':
  Metadata:
    encoder         : Lavf57.7.2
    Stream #0:0: Video: mpeg4 [ [0][0][0] / 0x0020]
      yuv420p, 1310x560, q=2-31, 200 kb/s
      24 fps, 24 tbn
    Metadata:
      encoder         : Lavc57.25.0 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=    1 fps=  0 q=3.2 Lsize=      16kB time=10000000000.00 bitrate=   0.0kbits/s    
video:15kB audio:0kB other streams:0kB global headers:0kB muxing overhead: 5.397969%

然后当我检查我的 video.mp4 时它不起作用。我的意思是视频立即开始和停止。

272M 孔 0.0001.mp4.ppm

16K孔.mp4

显示 Hole0.0001.mp4.ppm 的输出给我这个:

如您所见,文件 Hole0.0001.mp4.ppm

中有 150 帧
(base) alexandre@alexandre-Latitude-E7270:~/Documents$ ffprobe Hole0.0001.mp4.ppm 
ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Hole0.0001.mp4.ppm: Invalid data found when processing input
(base) alexandre@alexandre-Latitude-E7270:~/Documents$ ffplay Hole0.0001.mp4.ppm 
ffplay version 3.4.8-0ubuntu0.2 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Hole0.0001.mp4.ppm: Invalid data found when processing inputf=0/0 

当我使用这个命令时,我得到:

(base) alexandre@alexandre-Latitude-E7270:~/Documents$ display -verbose Hole0.0001.mp4.ppm 
Hole0.0001.mp4.ppm[0] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.690u 0:00.699
Hole0.0001.mp4.ppm[1] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.680u 0:00.690
Hole0.0001.mp4.ppm[2] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.680u 0:00.690
Hole0.0001.mp4.ppm[3] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.670u 0:00.679
Hole0.0001.mp4.ppm[4] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.670u 0:00.679
Hole0.0001.mp4.ppm[5] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.670u 0:00.670
Hole0.0001.mp4.ppm[6] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.660u 0:00.670
Hole0.0001.mp4.ppm[7] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.650u 0:00.670
Hole0.0001.mp4.ppm[8] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.650u 0:00.660
Hole0.0001.mp4.ppm[9] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.650u 0:00.660
Hole0.0001.mp4.ppm[10] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.650u 0:00.650
Hole0.0001.mp4.ppm[11] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.640u 0:00.650
Hole0.0001.mp4.ppm[12] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.640u 0:00.650
Hole0.0001.mp4.ppm[13] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.630u 0:00.640
Hole0.0001.mp4.ppm[14] PPM 1310x560 1310x560+0+0 8-bit sRGB 330.1MB 0.630u 0:00.640

你有什么想法吗?

谢谢

我发现此命令有效,但视频质量很差..

avconv -r 10 -vcodec ppm -f image2pipe -i Hole0.0001.mp4.ppm -r 20 Hole.mp4