Comments (3)
I have addressed this issue by simply ignoring multi-line data in my fork https://github.com/erat-verbum/ffprobe-python
Feel free to use it.
from ffprobe-python.
I encountered the same issue. The problem is the code assumes all information within the "stream" tag are one liner of the form <KEY>=<VALUE>
.
But ffprobe may return multi-line <VALUE>
. For example, my ffprobe output is like:
[STREAM]
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=929999/44640000
codec_tag_string=avc1
codec_tag=0x31637661
width=1080
height=1080
coded_width=1088
coded_height=1088
closed_captions=0
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=1:1
pix_fmt=yuvj420p
level=32
color_range=pc
color_space=bt470bg
color_transfer=smpte170m
color_primaries=bt470bg
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24/1
avg_frame_rate=22320000/929999
time_base=1/90000
start_pts=0
start_time=0.000000
duration_ts=929999
duration=10.333322
bit_rate=12313617
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=248
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:rotate=90
TAG:creation_time=2022-04-01T02:28:17.000000Z
TAG:language=eng
TAG:handler_name=VideoHandle
[SIDE_DATA]
side_data_type=Display Matrix
displaymatrix=
00000000: 0 65536 0
00000001: -65536 0 0
00000002: 0 0 1073741824
rotation=-90
[/SIDE_DATA]
[/STREAM]
There are sub-fields [SIDE_DATA]
and multi-line field like displaymatrix
that messes up the parsing logic.
from ffprobe-python.
If anyone's looking for a longer-term solution, I've switched to a ffprobe -print_format json
command-line that should handle multi-line data without any problems (because it's all JSON, so it doesn't need to be parsed line-by-line), plus a bunch of other bug-fixes, features, and improvements, in a fork:
https://github.com/jboy/ffprobe3-python3
(Python3 only, sorry.)
from ffprobe-python.
Related Issues (13)
- ValueError: not enough values to unpack (expected at least 2, got 1) HOT 3
- ImportError: cannot import name 'FFProbe' from partially initialized module 'ffprobe' HOT 8
- Would like duration in milliseconds rather than rounded seconds.
- SRT protocol
- Error probing file HOT 6
- AttributeError: 'NoneType' object has no attribute 'groups' HOT 3
- Installing with pip is broken with setuptools 59.x.y
- Chapters HOT 3
- Trying to convert m4a to wav format using Python code from an AML pipeline. When run from an AML pipeline on a Compute Cluster it fails stating: ImportError: cannot import name 'FFProbe' from partially initialized module 'ffprobe'
- Use ffprobe's -print_format json to parse, and also let ffprobe handle the "file" instead HOT 3
- Parsing-Error when probing wav-files
- Support remote video files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffprobe-python.