I'm trying to read all the tracks from a GoPro Hero9 camera mp4 file. The AVAsset tracks method says there are only 3 tracks, while ffmpeg says there are 5. I'm particularly interested in the "gpmd" track, which contains GPS data, which AVAsset seemingly does not recognize. Any suggestions? Mac and ffmpeg output below.
macOS code
XLog(@"AVAsset creation date = %@", asset.creationDate.value);
XLog(@"AVAsset tracks.count = %ld", asset.tracks.count);
NSArray *trackA = asset.tracks;
index = 0;
for (AVAssetTrack *track in trackA) {
XLog(@"%ld. trackID = %d", index, track.trackID);
XLog(@"%ld. mediaType = %@", index, track.mediaType);
XLog(@"%ld. data size = %@", index, NSStringFromSize(track.naturalSize));
XLog(@"___________________________");
index++;
}
}
produces
🔷AVAsset creation date = 2022-11-13 13:33:57 +0000
🔷AVAsset tracks.count = 3
🔷0. trackID = 1
🔷0. mediaType = vide
🔷0. data size = {3840, 2160}
🔷___________________________
🔷1. trackID = 2
🔷1. mediaType = soun
🔷1. data size = {0, 0}
🔷___________________________
🔷2. trackID = 3
🔷2. mediaType = tmcd
🔷2. data size = {0, 0}
ffmpeg -i GX010045.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GX010045.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2022-11-13T13:33:57.000000Z
location : +38.0357-122.5819/
location-eng : +38.0357-122.5819/
firmware : HD9.01.01.72.00
Duration: 00:08:52.54, start: 0.000000, bitrate: 60206 kb/s
Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 59941 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
Metadata:
creation_time : 2022-11-13T13:33:57.000000Z
handler_name : GoPro H.265
vendor_id : [0][0][0][0]
encoder : GoPro H.265 encoder
timecode : 13:33:09:07
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2022-11-13T13:33:57.000000Z
handler_name : GoPro AAC
vendor_id : [0][0][0][0]
timecode : 13:33:09:07
Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2022-11-13T13:33:57.000000Z
handler_name : GoPro TCD
timecode : 13:33:09:07
Stream #0:3[0x4](eng): Data: bin_data (gpmd / 0x646D7067), 48 kb/s (default)
Metadata:
creation_time : 2022-11-13T13:33:57.000000Z
handler_name : GoPro MET
Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
Metadata:
creation_time : 2022-11-13T13:33:57.000000Z
handler_name : GoPro SOS
At least one output file must be specified