Opened 4 years ago
Last modified 13 months ago
#8338 new enhancement
can't copy GoPro metadata
Reported by: | importon | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avformat |
Version: | git-master | Keywords: | mov |
Cc: | bertmcintosh@gmail.com | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug: I'm trying to swap out the video track of a GoPro mp4 file (0.mp4) with another (1.mp4) while keeping all the GPMF metadata in the 1st GoPro file. It results in error message "[mp4 @ 000002a357fdef40] Could not find tag for codec none in stream #2, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument 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)"
How to reproduce:
ffmpeg -i 0.MP4 -i 1.mp4 -map_metadata 0 -map 0 -movflags use_metadata_tags -c copy -copy_unknown GHO10772mux.MP4
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Change History (13)
comment:1 by , 4 years ago
Priority: | normal → important |
---|
comment:2 by , 4 years ago
Cc: | added |
---|
comment:3 by , 4 years ago
Keywords: | metadata gopro removed |
---|---|
Priority: | important → normal |
comment:4 by , 4 years ago
Thanks for the follow up.
I can't make my sample files small enough(2.5mb)to attach them so please grab them from here.
https://drive.google.com/drive/folders/1Sow7A_Wz_K4Ug-2RwX3YAqCAlAEDia2J?usp=sharing
I upgraded to ffmpeg version 20191028-68f623d and ran the following with the results below.
ffmpeg -i 0.MP4 -i 1.mp4 -map_metadata 0 -map 0 -movflags use_metadata_tags -c copy -copy_unknown 01mux.mp4
ffmpeg version N-92498-g77bf85515e Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --enable-gpl --enable-version3 --enable-sdl2 --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. 23.101 / 56. 23.101
libavcodec 58. 39.100 / 58. 39.100
libavformat 58. 22.100 / 58. 22.100
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 46.100 / 7. 46.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001c2556aa6c0] Using non-standard frame rate 59/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '0.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2019-05-03T16:55:07.000000Z
firmware : HD6.01.01.60.00
Duration: 00:00:06.42, start: 0.000000, bitrate: 47516 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 47337 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
creation_time : 2019-05-03T16:55:07.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 17:11:17:56
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 188 kb/s (default)
Metadata:
creation_time : 2019-05-03T16:55:07.000000Z
handler_name : GoPro AAC
timecode : 17:11:17:56
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2019-05-03T16:55:07.000000Z
handler_name : GoPro TCD
timecode : 17:11:17:56
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 37 kb/s (default)
Metadata:
creation_time : 2019-05-03T16:55:07.000000Z
handler_name : GoPro MET
Stream #0:4(eng): Data: none (fdsc / 0x63736466), 14 kb/s (default)
Metadata:
creation_time : 2019-05-03T16:55:07.000000Z
handler_name : GoPro SOS
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.22.100
Duration: 00:00:06.42, start: 0.000000, bitrate: 101923 kb/s
Stream #1:0(eng): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1920x1080 [SAR 1:1 DAR 16:9], 101967 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
handler_name : GoPro AVC
timecode : 17:11:17:56
Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 188 kb/s (default)
Metadata:
handler_name : GoPro AAC
Stream #1:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : GoPro AVC
timecode : 17:11:17:56
[mp4 @ 000001c2556aef00] You requested a copy of the original timecode track so timecode metadata are now ignored
[mp4 @ 000001c2556aef00] Could not find tag for codec none in stream #2, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
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)
Last message repeated 1 times
comment:5 by , 4 years ago
Component: | undetermined → avformat |
---|---|
Keywords: | mov added |
Priority: | normal → wish |
Type: | defect → enhancement |
Version: | unspecified → git-master |
I believe the following works as expected:
ffmpeg -i 0.MP4 -c copy -map 0:v -map 0:a -map 0:3 out.mp4
The fdsc
tag is unsupported afaict.
comment:6 by , 4 years ago
Thanks again for looking into this.
Unfortunately that does not copy all the GPMF metadata over. Is there anything in the works to handle GoPro GPMF data? More info here https://github.com/gopro/gpmf-parser.
comment:7 by , 4 years ago
Cc: | added |
---|
comment:8 by , 4 years ago
Cc: | removed |
---|
follow-up: 10 comment:9 by , 3 years ago
Hi. I just wanted to follow up on this. I got a similar error when trying to cut an .mp4 GoPro video with an app that relies on FFmpeg. According to the developer, "it seems that FFmpeg tries to process the data streams and fails to write that 'none' tag".
Here's the original issue so you can see the context: https://gitlab.gnome.org/YaLTeR/video-trimmer/-/issues/22
comment:10 by , 3 years ago
Replying to eldelacajita:
Hi. I just wanted to follow up on this. I got a similar error when trying to cut an .mp4 GoPro video with an app that relies on FFmpeg. According to the developer, "it seems that FFmpeg tries to process the data streams and fails to write that 'none' tag".
Here's the original issue so you can see the context: https://gitlab.gnome.org/YaLTeR/video-trimmer/-/issues/22
If this is the case, would this be considered a bug that might be escalated to possibly being fixed? How does that process work?
comment:11 by , 2 years ago
Any solution to this? - I tried:
ffmpeg -i 0.MP4 -c copy -map 0:v -map 0:a -map 0:3 out.mp4
But I get 4 steams in my output file instead of 5 in the original.
if I change to -map 0:4 it says:
$ ffmpeg -i GX010804\ NEW.MP4 -c copy -map 0:v -map 0:a -map 0:4 -y out.mp4 ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers built with Apple clang version 12.0.5 (clang-1205.0.22.9) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GX010804 NEW.MP4': Metadata: major_brand : mp41 minor_version : 538120216 compatible_brands: mp41 creation_time : 2021-04-24T16:42:06.000000Z firmware : HD8.01.02.50.00 Duration: 00:05:09.96, start: 0.000000, bitrate: 60283 kb/s Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 60022 kb/s, 50 fps, 50 tbr, 90k tbn, 50 tbc (default) Metadata: creation_time : 2021-04-24T16:42:06.000000Z handler_name : GoPro H.265 vendor_id : [0][0][0][0] encoder : GoPro H.265 encoder timecode : 16:42:06:19 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default) Metadata: creation_time : 2021-04-24T16:42:06.000000Z handler_name : GoPro AAC vendor_id : [0][0][0][0] timecode : 16:42:06:19 Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default) Metadata: creation_time : 2021-04-24T16:42:06.000000Z handler_name : GoPro TCD timecode : 16:42:06:19 Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 45 kb/s (default) Metadata: creation_time : 2021-04-24T16:42:06.000000Z handler_name : GoPro MET Stream #0:4(eng): Data: none (fdsc / 0x63736466), 12 kb/s (default) Metadata: creation_time : 2021-04-24T16:42:06.000000Z handler_name : GoPro SOS [mp4 @ 0x12d81d000] Could not find tag for codec none in stream #2, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:2 -- Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:4 -> #0:2 (copy) Last message repeated 1 times ``` Any solution to this?
comment:13 by , 13 months ago
I tested the latest version of FFmpeg and this issue still occurs, ffmpeg refuses to copy the GPMD metadata stream with the same error message "Could not find tag for codec none in stream #2, codec not currently supported in container" when working with MP4 files.
I can copy such a GoPro stream to other file formats (TS or MOV, for example) just fine, but that doesn't help me if I need to edit the original MP4 files coming from a GoPro camera.
I have also not found any other MP4 editing tool that can work with these files - but I can't imagine just having write support for that raw binary type could be that hard. FFmpeg already properly detects it and can extract it from a video, it just can't add it back to a video.
Is there any chance of FFmpeg getting support for writing GoPro metadata to an MP4 file?
Also, I'd agree with the statement in comment 10 that this should be a bug, not a feature request.
In general, swapping is not possible because
ffmpeg
is a transcoding tool, not a file editor.Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output and a short input sample to make this a valid ticket.