Can't import: vedit.Video( './video.mp4' )
Closed this issue · 6 comments
>>> source = vedit.Video( './videos/video.mp4' )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/vedit/vedit.py", line 322, in __init__
info = json.loads( output )
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
My best guess would be something is wrong with ffprobe, or the output format of ffprobe is different on your system from mine.
Could you verify if you've installed the related tools this depends on as described at:
https://github.com/digitalmacgyver/vedit#before-you-begin
Can you post here the outputs of:
ffprobe -v quiet -print_format json -show_streams ./videos/video.mp4
On your system?
ffmpeg & ffprobe are installed
ffprobe -v quiet -print_format json -show_streams ./videos/video.mp4
{
"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_time_base": "1/60",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 404,
"height": 720,
"coded_width": 404,
"coded_height": 720,
"has_b_frames": 2,
"sample_aspect_ratio": "0:1",
"display_aspect_ratio": "0:1",
"pix_fmt": "yuv420p",
"level": 30,
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "30/1",
"avg_frame_rate": "30/1",
"time_base": "1/15360",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 1536000,
"duration": "100.000000",
"bit_rate": "200614",
"bits_per_raw_sample": "8",
"nb_frames": "3000",
"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": {
"language": "und",
"handler_name": "VideoHandler"
}
},
{
"index": 1,
"codec_name": "mp3",
"codec_long_name": "MP3 (MPEG audio layer 3)",
"codec_type": "audio",
"codec_time_base": "1/44100",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "s16p",
"sample_rate": "44100",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/44100",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 1575958,
"duration": "35.736009",
"bit_rate": "127999",
"max_bit_rate": "128000",
"nb_frames": "1369",
"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": {
"language": "und",
"handler_name": "SoundHandler"
}
}
]
}
Thanks for that - that all looks right.
Let's dig deeper can you post here the console output of:
import vedit
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel( logging.DEBUG )
source = vedit.Video( './videos/video.mp4' )
?
Sure,
>>> import vedit
>>> import logging
>>> logging.basicConfig()
>>> log = logging.getLogger()
>>> log.setLevel( logging.DEBUG )
>>> source = vedit.Video( './videos/video.mp4' )
WARNING:vedit.vedit:Nonsense SAR value of 0:1 detected, assuming SAR is 1:1.
OK - that is interesting - the initial report showed an exception on the source = vedit.Video( './videos/video.mp4' )
line, but the thing above shows it working (with a warning).
I wonder if there was some intermittent thing or race condition that caused the initial error.
What happens if you try to run through the rest of what you were trying to do? Is it working now or are there more errors?
Correct;
I've installed many libs since, trace the root cause of what fixed the error will be hard.