iPhone의 .MOV 비디오 파일을 재생 가능한 .mp4 파일로 변환

iPhone의 .MOV 비디오 파일을 재생 가능한 .mp4 파일로 변환

나는 아이폰에서 비디오를 녹화하고 vcodec hevc를 사용하여 .MOV 파일을 얻습니다. 그대로, 소프트 편집 시 재생할 수 없고 사용할 수 없습니다.

그래서 ffmpeg 명령을 사용하여 .mp4 파일로 변환하려고 했습니다.

ffmpeg -i input.MOV output.mp4

하지만 outpul.mp4는 여전히 재생할 수 없습니다(비디오는 없고 노래만 있음). 또한 vcodec 에 옵션을
사용하려고 시도했지만 결과는 동일합니다.-vcodech264

ffmpeg -i input.MOV -vcodec h264 output.mp4

다른 옵션(동일한 문제):

ffmpeg -i input.mov -c:v libx264 -c:a copy output.mp4

명령 출력:

me@my_pc:~/Test_vid$ ffmpeg -i input.mov -c:v libx264 -c:a copy output.mp4
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2022-11-25T17:30:29.000000Z
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 12 mini
    com.apple.quicktime.software: 16.1.1
    com.apple.quicktime.creationdate: 2022-11-25T18:30:29+0100
  Duration: 00:00:40.33, start: 0.000000, bitrate: 8758 kb/s
    Stream #0:0(und): Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67), 1920x1080, 8503 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 600 tbc (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Video
      encoder         : HEVC
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 174 kb/s (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Audio
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Metadata
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 22 kb/s (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Metadata
    Stream #0:4(und): Data: none (mebx / 0x7862656D), 41 kb/s (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Metadata
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[libx264 @ 0x55f0334ad440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[libx264 @ 0x55f0334ad440] profile High 10, level 4.0, 4:2:0 10-bit
[libx264 @ 0x55f0334ad440] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=81 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.creationdate: 2022-11-25T18:30:29+0100
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 12 mini
    com.apple.quicktime.software: 16.1.1
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p10le, 1920x1080, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Video
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 174 kb/s (default)
    Metadata:
      creation_time   : 2022-11-25T17:30:29.000000Z
      handler_name    : Core Media Audio
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62me=00:00:02.78 bitrate=   0.1kbits/s speed=3.78x

        [...]

[hevc @ 0x55f033591e40] Skipping NAL unit 62ime=00:00:40.30 bitrate=1664.9kbits/s speed=1.42x
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
[hevc @ 0x55f033560140] Skipping NAL unit 62
[hevc @ 0x55f033570b40] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f033581480] Skipping NAL unit 62
[hevc @ 0x55f033591e40] Skipping NAL unit 62
[hevc @ 0x55f0335a2840] Skipping NAL unit 62
[hevc @ 0x55f0335b3240] Skipping NAL unit 62ime=00:00:40.30 bitrate=1716.9kbits/s speed=1.39x
[hevc @ 0x55f0334abf40] Skipping NAL unit 62
[hevc @ 0x55f0334d46c0] Skipping NAL unit 62
[hevc @ 0x55f0334d07c0] Skipping NAL unit 62
frame= 1209 fps= 40 q=-1.0 Lsize=    9280kB time=00:00:40.30 bitrate=1886.0kbits/s speed=1.33x
video:8377kB audio:858kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.477651%
[libx264 @ 0x55f0334ad440] frame I:5     Avg QP:29.89  size:128648
[libx264 @ 0x55f0334ad440] frame P:305   Avg QP:32.50  size: 16641
[libx264 @ 0x55f0334ad440] frame B:899   Avg QP:37.34  size:  3180
[libx264 @ 0x55f0334ad440] consecutive B-frames:  0.7%  0.5%  0.2% 98.6%
[libx264 @ 0x55f0334ad440] mb I  I16..4:  6.1% 81.9% 12.0%
[libx264 @ 0x55f0334ad440] mb P  I16..4:  0.9%  2.9%  0.2%  P16..4: 34.1%  5.3%  4.4%  0.0%  0.0%    skip:52.2%
[libx264 @ 0x55f0334ad440] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 22.7%  0.6%  0.1%  direct: 0.3%  skip:76.1%  L0:32.6% L1:65.6% BI: 1.8%
[libx264 @ 0x55f0334ad440] 8x8 transform intra:74.3% inter:80.4%
[libx264 @ 0x55f0334ad440] coded y,uvDC,uvAC intra: 55.2% 27.0% 2.7% inter: 6.5% 2.1% 0.0%
[libx264 @ 0x55f0334ad440] i16 v,h,dc,p: 35% 19% 14% 32%
[libx264 @ 0x55f0334ad440] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 13% 22%  6% 11%  9% 10%  7%  8%
[libx264 @ 0x55f0334ad440] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 16% 13%  7% 15% 10% 11%  6%  7%
[libx264 @ 0x55f0334ad440] i8c dc,h,v,p: 77%  9% 11%  3%
[libx264 @ 0x55f0334ad440] Weighted P-Frames: Y:4.9% UV:1.3%
[libx264 @ 0x55f0334ad440] ref P L0: 70.8% 19.7%  9.5%  0.1%
[libx264 @ 0x55f0334ad440] ref B L0: 88.6%  9.2%  2.2%
[libx264 @ 0x55f0334ad440] ref B L1: 94.6%  5.4%
[libx264 @ 0x55f0334ad440] kb/s:1701.08
me@my_pc:~/Test_vid$

input.MOV mediainfo 출력:

user@my-PC:~/Downloads$ mediainfo input.MOV
General
Complete name                            : input.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   0000.00 (qt  )
File size                                : 14.6 MiB
Duration                                 : 8 s 107 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 15.1 Mb/s
Encoded date                             : UTC 2022-11-30 17:41:45
Tagged date                              : UTC 2022-11-30 17:41:54
Writing library                          : Apple QuickTime
com.apple.quicktime.make                 : Apple
com.apple.quicktime.model                : iPhone 12 mini
com.apple.quicktime.software             : 16.1.1
com.apple.quicktime.creationdate         : 2022-11-30T18:41:45+0100

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L4@Main
HDR format                               : Dolby Vision, Version 1.0, dvhe.08.04, BL+RPU
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 8 s 105 ms
Bit rate                                 : 14.9 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Rotation                                 : 90°
Frame rate mode                          : Variable
Frame rate                               : 29.970 (29970/1000) FPS
Minimum frame rate                       : 28.571 FPS
Maximum frame rate                       : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.240
Stream size                              : 14.4 MiB (99%)
Title                                    : Core Media Video
Encoded date                             : UTC 2022-11-30 17:41:45
Tagged date                              : UTC 2022-11-30 17:41:54
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : HLG
Matrix coefficients                      : BT.2020 non-constant
Codec configuration box                  : hvcC+dvvC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 8 s 105 ms
Source duration                          : 8 s 173 ms
Bit rate mode                            : Variable
Bit rate                                 : 144 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 143 KiB (1%)
Source stream size                       : 144 KiB (1%)
Title                                    : Core Media Audio
Encoded date                             : UTC 2022-11-30 17:41:45
Tagged date                              : UTC 2022-11-30 17:41:54

Other #1
Type                                     : meta
Duration                                 : 8 s 107 ms

Other #2
Type                                     : meta
Duration                                 : 8 s 107 ms

Other #3
Type                                     : meta
Duration                                 : 8 s 107 ms

답변1

호환되지 않는 비디오 코덱(HVEC는 호환 가능)을 고려하여 비디오 코덱을 다시 인코딩해야 합니다.

ffmpeg -i input.mov -c:v libx264 -c:a copy output.mp4 

오디오 코덱은 다음을 사용하여 필터링해야 합니다.

-bsf:a aac_adtstoasc

잘라내기를 원하거나 그래픽으로 하고 싶다면 다음을 제안하고 싶습니다.비디오컷ppa로 가져올 수 있습니다.

https://launchpad.net/~jentiger-moratai/+archive/ubuntu/mediatools

설치하려면 다음을 실행해야 합니다.

sudo add-apt-repository ppa:jentiger-moratai/mediatools
sudo apt update
sudo apt install --no-install-recommends install videocut

업데이트

내 VideoCut 앱으로 테스트해 보면 다음과 같이 요약됩니다.

ffmpeg -i input.mov -c:v copy -c:a copy -bsf:a aac_adtstoasc -avoid_negative_ts 1 -shortest input2.mp4

이것이 ffmpeg muxer가 수행하는 가장 빠른 방법입니다. 패킷을 복사하는 동안 오디오 필터는 해당 컨테이너(mov 대 mp4)에서 오디오 코덱의 비호환성을 제거하는 데 사용됩니다. 마지막 2개의 스위치는 오디오 동기화에 사용됩니다.

위에서 언급한 대로 VideoCut은 이 작업을 자동으로 수행합니다. 내장된 "remux" muxer를 사용하면 잠재적으로 누락된 첫 번째 프레임을 처리할 수 있습니다(ffmeg는 처리하지 않음).

관련 정보