feat: add ffprobe metadata extraction (profile, level, bit depth, ref frames, audio language)#334
Conversation
|
I have to give it a thought, since ideally a single connection to the provider would be optimal. I´ll try to do it via the ffmpeg process so it can route a ffprobe without opening a new connection. |
|
That's a fair point — hadn't thought about the concurrent connection issue when providers enforce a single-stream limit. I had a look at what ffmpeg's stderr actually gives us when it starts up. Most of what I need is already there: profile, pixel format (bit depth), sample rate, channel layout, and audio language all show up in the stream info lines. Level sometimes appears inline too (e.g. So if it makes more sense, I could rework this to parse the existing ffmpeg stderr output instead of the separate ffprobe call — that way there's no second connection at all. The only thing we'd lose is reliable level and ref frame extraction, but those are edge cases anyway. Happy to go that route if you'd prefer it over the ffprobe approach. |
cbf254d to
78be589
Compare
…epth, ref frames and audio language Adds a new get_stream_metadata() function to stream_check_utils.py that runs a fast ffprobe JSON call (~2-3s) before the existing ffmpeg bitrate analysis. Extracts structured metadata not reliably available from ffmpeg debug output: Video: profile (High/Main), level (e.g. 42), bit depth (8/10), ref frame count Audio: language tag (ISO 639-2), sample rate, channel layout Results are merged into the analyze_stream() result dict and included in the stream_stats payload written to Dispatcharr by both _update_stream_stats() and _prepare_stream_stats_for_batch(). This enables downstream consumers (e.g. Emby/Jellyfin plugins) to make correct direct-play vs transcode decisions for HEVC 10-bit content, high ref-frame H.264, and multi-language streams without probing at playback time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…robe call Replaces the standalone ffprobe JSON call with inline parsing of ffmpeg's existing stderr output. All new fields (video_profile, video_bit_depth, audio_language, sample_rate, audio_channels) are extracted from the stream info lines that ffmpeg already prints during analysis — no second upstream connection is opened. video_level and video_ref_frames are dropped; these are not reliably present in ffmpeg stderr output.
78be589 to
736ccb6
Compare
|
Check the latest dev build to see if it satisfies your requirements. |
What this adds
Extends the existing ffmpeg stderr parsing in
get_stream_info_and_bitrate()to pull additional metadata out of the stream info lines that ffmpeg already prints — no second upstream connection is opened.New fields in
stream_statsvideo_profile"High"Video: h264 (High), ...video_bit_depth10yuv420p10le→ 10,yuv420p→ 8audio_language"eng"Stream #0:1(eng):sample_rate48000Audio: aac, 48000 Hz, ...audio_channels"5.1"..., 5.1(side), ...— trailing(side)/(back)strippedvideo_levelandvideo_ref_framesare not included — they're not reliably present in ffmpeg debug output and would require a separate probe call to get them consistently.Backwards compatibility
{k: v for k, v in ... if v not in [None, "N/A"]}cleanup