avconv를 사용하여 PPM을 MP4로 변환하는 방법

avconv를 사용하여 PPM을 MP4로 변환하는 방법

.PPM 비디오 파일을 MP4 비디오 파일로 변환하려고 합니다 avconv. 나는 이것을 시도했습니다 :

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%

그러다가 생성된 MP4 동영상 파일을 확인해 보니 Hole.mp4작동이 되지 않습니다. 내 말은 비디오가 즉시 시작되고 중지된다는 것입니다.

272M Hole0.0001.mp4.ppm
16K Hole.mp4 

display 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

내가 뭘 잘못했나요? 이 문제를 어떻게 해결할 수 있나요?

답변1

나는 이것이 더 낫다는 것을 알았습니다.

avconv -r 10 -vcodec ppm -f image2pipe -i Hole0.0001.mp4.ppm -vcodec mpeg4 -vb 40M -r 20 Hole.mp4

관련 정보