我用我的 iPhone 录制了一些视频,并使用 vcodec hevc 获得了 .MOV 文件。但实际上,它在编辑软件上无法播放和使用。
因此我尝试使用 ffmpeg 命令将其转换为 .mp4 文件:
ffmpeg -i input.MOV output.mp4
但是 outpul.mp4 仍然无法播放(没有视频,只有歌曲)
我也尝试使用-vcodec
带有 vcodec 的选项h264
,但结果是一样的。
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$
输入.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 复用器最快的方式。在复制数据包时,使用音频过滤器来消除各个容器中音频编解码器的不兼容性(mov vs mp4)。最后 2 个开关用于音频同步
如上所述,VideoCut 会自动执行此操作。使用内置的“remux”复用器将处理可能丢失的第一帧(ffmeg 不会这样做)