Closed SiliconFiend closed 2 years ago
I have the same issue with a file from a Hero 8 Black:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/__main__.py", line 3, in <module>
main()
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/gopro2gpx.py", line 148, in main
data = parser.readFromMP4()
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/gpmf.py", line 58, in readFromMP4
metadata = self.parseStream(metadata_raw)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/gpmf.py", line 97, in parseStream
klv = KLVData(data,offset)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/klvdata.py", line 34, in __init__
self.data = fourCC.Manage(self)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/fourCC.py", line 391, in Manage
return labels[klvdata.fourCC]().Build(klvdata)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/fourCC.py", line 133, in Build
data = XYZData._make(s.unpack_from(klvdata.rawdata))
TypeError: a bytes-like object is required, not 'NoneType'
This seems to be an issue with the parsing of ffprobe
output to find the data track in the MP4.
Do you have ffmpeg (which includes ffprobe) installed and in the PATH
(or set the path in the gopro2gpx config file (see README)?
In any case I think 2 changed should be considered:
ffprobe
for parsing instead of Regex to parse to Human-readable ouput, as there is a native JSON parser in Python and JSON output of ffprobe
will be more stable over time (ffprobe command e.g.: ffprobe -print_format json -show_streams video.mp4
)@Simske
% python3 -m venv gopro2gpx
% source gopro2gpx/bin/activate
% pip install git+https://github.com/juanmcasillas/gopro2gpx
% gopro2gpx _samples/test.mp4 test
Traceback (most recent call last):
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/bin/gopro2gpx", line 33, in <module>
sys.exit(load_entry_point('gopro2gpx==0.1', 'console_scripts', 'gopro2gpx')())
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/bin/gopro2gpx", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/__main__.py", line 3, in <module>
main()
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/gopro2gpx.py", line 148, in main
data = parser.readFromMP4()
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/gpmf.py", line 58, in readFromMP4
metadata = self.parseStream(metadata_raw)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/gpmf.py", line 97, in parseStream
klv = KLVData(data,offset)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/klvdata.py", line 34, in __init__
self.data = fourCC.Manage(self)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/fourCC.py", line 391, in Manage
return labels[klvdata.fourCC]().Build(klvdata)
File "/Users/davisa/code/python/gopro2gpx/gopro2gpx/lib/python3.9/site-packages/gopro2gpx/fourCC.py", line 133, in Build
data = XYZData._make(s.unpack_from(klvdata.rawdata))
TypeError: a bytes-like object is required, not 'NoneType'
% which ffprobe
/usr/local/bin/ffprobe
% ffprobe -print_format json -show_streams _samples/test.mp4
ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --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-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 '_samples/test.mp4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2021-03-26T09:44:06.000000Z
firmware : HD8.01.02.50.00
location : +33.7547-115.3197/
location-eng : +33.7547-115.3197/
Duration: 00:00:29.66, start: 0.000000, bitrate: 46244 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 44988 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
creation_time : 2021-03-26T09:44:06.000000Z
handler_name : GoPro AVC
vendor_id : [0][0][0][0]
encoder : GoPro AVC encoder
timecode : 09:45:20:55
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2021-03-26T09:44:06.000000Z
vendor_id : [0][0][0][0]
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
rotate : 0
creation_time : 2021-03-26T09:44:06.000000Z
timecode : 09:45:20:55
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 48 kb/s (default)
Metadata:
creation_time : 2021-03-26T09:44:06.000000Z
handler_name : GoPro MET
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 100359 for input stream 3
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "High",
"codec_type": "video",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1920,
"height": 1080,
"coded_width": 1920,
"coded_height": 1080,
"closed_captions": 0,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuvj420p",
"level": 42,
"color_range": "pc",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "60000/1001",
"avg_frame_rate": "60000/1001",
"time_base": "1/60000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 1779795,
"duration": "29.663250",
"bit_rate": "44988537",
"bits_per_raw_sample": "8",
"nb_frames": "1817",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"creation_time": "2021-03-26T09:44:06.000000Z",
"language": "eng",
"handler_name": "\u000bGoPro AVC ",
"vendor_id": "[0][0][0][0]",
"encoder": "GoPro AVC encoder",
"timecode": "09:45:20:55"
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 1423836,
"duration": "29.663250",
"bit_rate": "189362",
"nb_frames": "1422",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"creation_time": "2021-03-26T09:44:06.000000Z",
"language": "eng",
"vendor_id": "[0][0][0][0]"
}
},
{
"index": 2,
"codec_type": "data",
"codec_tag_string": "tmcd",
"codec_tag": "0x64636d74",
"r_frame_rate": "0/0",
"avg_frame_rate": "60000/1001",
"time_base": "1/60000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 1779795,
"duration": "29.663250",
"bit_rate": "1",
"nb_frames": "1",
"disposition": {
"default": 0,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"rotate": "0",
"creation_time": "2021-03-26T09:44:06.000000Z",
"language": "eng",
"timecode": "09:45:20:55"
}
},
{
"index": 3,
"codec_name": "bin_data",
"codec_long_name": "binary data",
"codec_type": "data",
"codec_tag_string": "gpmd",
"codec_tag": "0x646d7067",
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/1000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 29663,
"duration": "29.663000",
"bit_rate": "48730",
"nb_frames": "31",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"creation_time": "2021-03-26T09:44:06.000000Z",
"language": "eng",
"handler_name": "\tGoPro MET"
}
}
]
}
I'm getting this same error, but due to a new format for the ffprobe stream information:
Stream #0:3[0x4](eng): Data: bin_data (gpmd
I modified line 43 of ffmpegtools with the following regex: Stream #\d:(\d)(?:\[0x\d+\])?\(.+\): Data: \w+ \(gpmd
Hello,
Added the regex in the next patch.
Thanks!
Experienced this issue with the MP4 file as well as an extracted BIN GPMF. Other files seem to work fine so there's something specific about this one. Camera is a Hero 8 Black. It was running the GoPro Labs firmware when this video was captured, but no strange settings were enabled.
In the second and third chapters of the same recording it has a slightly different error: