microsoft / microsoft/FFmpegInterop

Changing audio/video properties mid stream

Open
#45 24 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.4k
Forks
319
PR merge metrics
No merged PRs in 30d

Description

Sometimes digital TV from an antenna (live or recorded) will change key properties mid stream.

Audio might switch from 5.1 to 2 channel between a show and advertising, or the video might switch from 1080i (1920x1080x30fps) to 720p (1280x720x60fps) between shows.

The audio path uses swr_convert() to convert from floating point to S16 samples - this API segfaults internally when audio changes from 5.1 to 2 channel. I fixed the interop code to reinitialize the swr_convert context to 2/5.1 channel as needed - this fixes the segfault but now I need to tell the MediaFoundation layer that the PCM data I am passing it is now only 2 channel without interrupting playback.

Can you suggest a way to update the MediaFoundation properties mid-stream without interrupting playback?

(Currently focused on the audio change. Guessing the video size/framerate changing mid stream will have a similar solution).

Nick

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue centers on swr_convert() and the MediaFoundation layer, with interop code reinitializing the conversion context when audio channels change. Start by tracing that channel-change path; done would mean handling mid-stream audio property changes without a segmentation fault or playback interruption, with video changes considered afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.