Trimming an mp4 with ffmpeg makes it lose audio in iMovie

0

I'm using the following flags with ffmpeg to trim an mp4 video.

ffmpeg -i input.mp4 -ss position -to position -c copy -y output.mp4

The original video can be imported without a problem in iMovie. The trimmed video plays fine (with audio), but upon importing, loses the audio track.

If I look at the audio track in iMovie, it looks empty, so adjusting volume doesn't help.

Here's the command line output:

ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-05-21T02:06:03.000000Z
    com.android.version: 9
    com.android.manufacturer: Google
    com.android.model: Pixel XL
  Duration: 00:16:07.98, start: 0.000000, bitrate: 22099 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2019-05-21T02:06:03.000000Z
      handler_name    : SoundHandle
    Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 22000 kb/s, SAR 1:1 DAR 16:9, 30.01 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2019-05-21T02:06:03.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -180.00 degrees
Output #0, mp4, to 'so-output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.model: Pixel XL
    com.android.version: 9
    com.android.manufacturer: Google
    encoder         : Lavf57.83.100
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 22000 kb/s, 30.01 fps, 30 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2019-05-21T02:06:03.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -180.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2019-05-21T02:06:03.000000Z
      handler_name    : SoundHandle
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  571 fps=0.0 q=-1.0 Lsize=   51534kB time=00:00:19.99 bitrate=21117.7kbits/s speed=71.3x    
video:51280kB audio:234kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.038373%

user1170883

Posted 2019-05-29T02:55:23.727

Reputation: 1

1Please show the full, uncut command line output. – slhck – 2019-05-29T05:57:24.083

No answers