Score:0

Convert .MOV video file from Iphone to playable .mp4 file

cw flag

I record some video form my Iphone and I get .MOV files using vcodec hevc. As is, it's unplayable and unusable on editing soft.

So I tried to convert it to .mp4 file using ffmpeg comand:

ffmpeg -i input.MOV output.mp4

But outpul.mp4 is still unplayable (no video, only song)
I also tried to use -vcodec option with the h264 vcodec but the result is same.

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

With other option (same problem):

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

Command output :

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$

The input.MOV mediainfo output :

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
codlord avatar
ru flag
I don't know how to do it using ffmpeg but you could try Handbrake for a GUI tool to convert videos. It's available via Ubuntu software store etc. or via the website: https://handbrake.fr
andrew.46 avatar
in flag
Interestingly enough I run the latest FFmpeg from git and transcoding of your online sample is flawless.
Dryade avatar
cw flag
I personally I use the FFmpeg version avialable on ubutu that I installed with `apt`
Score:0
zw flag

Considering a non compatible video codec (HVEC is compatible),you need to reencode the video codec:

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

The audio codec needs to be filtered with:

-bsf:a aac_adtstoasc

If you want to cut it (or just do it graphically), I'd like to propose my VideoCut which can be imported as ppa:

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

To install you need to execute:

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

Update

Testing it with my VideoCut app it boils down to:

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

This is the fastest way the ffmpeg muxer does it. While copying the packets, an audio filter is used to remove incompatibilities of the audio codec in the respective containers (mov vs mp4). The last 2 switches are used for audio sync

As mentioned above, VideoCut does this automatically. Using the inbuild "remux" muxer will handle potentially missing first frames (which ffmeg doesn't)

Dryade avatar
cw flag
Your ffmpeg command doesn't work so I add mediainfo to my question.
kanehekili avatar
zw flag
Jupp, the codec info was missing I've updated my answer.
Dryade avatar
cw flag
I tried your new command but the output is still unplayable. I add the command output.
kanehekili avatar
zw flag
Could you cut a small piece of that video (1 minute) and put it on pastebin (or some other place?) Cutting with `ffmpeg -ss 00:01:00.00', -i input.mov -t 00:01:00.00 -c:v copy -c:a copy test.mov` . Plus check my updated answer.
Dryade avatar
cw flag
Yes, I put it on my website. I update my question. I try your commands, but still not work.
kanehekili avatar
zw flag
I used the aforementioned VideoCut app to check. See my udated answer
Dryade avatar
cw flag
I think your answer is now complete and surround the problem. It's ok for me.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.