0

I have a video file which was created with a GoPro camera. It has video and audio streams as well as 3 data streams. Below is the ffprobe output:

ffprobe version 4.0.2 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7.3.1 (GCC) 20180722
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR0143.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2018-10-08T16:14:37.000000Z
    location        : +50.1047+008.6600/
    location-eng    : +50.1047+008.6600/
    firmware        : HD5.02.02.00.00
  Duration: 00:08:52.01, start: 0.000000, bitrate: 60190 kb/s
    Chapter #0:0: start 63.460000, end 532.011000
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 59999 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 16:14:39:03
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro AAC
      timecode        : 16:14:39:03
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro TCD
      timecode        : 16:14:39:03
    Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 38 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 12 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro SOS
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
Unsupported codec with id 0 for input stream 4

I want to cut 5 seconds out of this video, starting from 00:00:02, but also preserving the data streams including all the metadata.

This is what I'm trying right now:

ffmpeg -y -i GOPR0143.MP4 \
 -ss 2 \
 -c copy \
 -map 0:0 \
 -map 0:1 \
 -map 0:2 \
 -map 0:3 \
 -map 0:4 \
 -t 5 \
 GOPR0143.t5.mp4

Unfortunately, the resulting file does not have GoPro TCD and GoPro SOS streams. Also handler_name is changed for video and audio streams. Below is the ffprobe output for the resulting file:

ffprobe version 4.0.2 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7.3.1 (GCC) 20180722
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR0143.t5.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    location-eng    : +50.1047+008.6600/
    location        : +50.1047+008.6600/
  Duration: 00:00:05.01, start: 0.000000, bitrate: 59885 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 59875 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (gpmd / 0x646D7067), 39 kb/s (default)
    Metadata:
      handler_name    : GoPro MET
Unsupported codec with id 0 for input stream 2

Full ffmpeg output:

ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  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
  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 'GOPR0143.MP4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2018-10-08T16:14:37.000000Z
    location        : +50.1047+008.6600/
    location-eng    : +50.1047+008.6600/
    firmware        : HD5.02.02.00.00
  Duration: 00:08:52.01, start: 0.000000, bitrate: 60190 kb/s
    Chapter #0:0: start 63.460000, end 532.011000
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 59999 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 16:14:39:03
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro AAC
      timecode        : 16:14:39:03
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro TCD
      timecode        : 16:14:39:03
    Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 38 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 12 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro SOS
[mp4 @ 000001a6625a1a40] You requested a copy of the original timecode track so timecode metadata are now ignored
Output #0, mp4, to 'GOPR0143.t5.mp4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : HD5.02.02.00.00
    location        : +50.1047+008.6600/
    location-eng    : +50.1047+008.6600/
    encoder         : Lavf57.83.100
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], q=2-31, 59999 kb/s, 50 fps, 50 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 16:14:39:03
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro AAC
      timecode        : 16:14:39:03
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro TCD
      timecode        : 16:14:39:03
    Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 38 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 12 kb/s (default)
    Metadata:
      creation_time   : 2018-10-08T16:14:37.000000Z
      handler_name    :     GoPro SOS
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
frame=   72 fps=0.0 q=-1.0 size=       0kB time=00:00:01.43 bitrate=   0.0kbits/s speed=2.86x    
frame=  250 fps=250 q=-1.0 size=       0kB time=00:00:04.99 bitrate=   0.0kbits/s speed=4.99x    
frame=  250 fps=166 q=-1.0 size=       0kB time=00:00:04.99 bitrate=   0.0kbits/s speed=3.33x    
frame=  250 fps=137 q=-1.0 Lsize=   36654kB time=00:00:04.99 bitrate=60085.3kbits/s speed=2.75x    
video:36545kB audio:78kB subtitle:0kB other streams:24kB global headers:0kB muxing overhead: 0.016465%

How can I preserve the data streams while cutting?

  • FFmpeg cannot, at present, remux these proprietary GoPro streams. – Gyan Apr 10 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.