Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not play if video dont have audio #3

Closed
pubpy2015 opened this issue Jul 10, 2020 · 8 comments
Closed

can not play if video dont have audio #3

pubpy2015 opened this issue Jul 10, 2020 · 8 comments

Comments

@pubpy2015
Copy link

Hi,

Seem your project cannot play if video don't have audio stream.
Please check

@pubpy2015
Copy link
Author

if disable setup audio, it works fine:
image

@SuRGeoNix
Copy link
Owner

I can play video streams without audio streams properly, can you send a screenshot from vlc Tools -> Codec information? or if you have a sample video so i can reproduce the problem?

@pubpy2015
Copy link
Author

That stream is from IP camera.
image

@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Jul 10, 2020

It seems that an Audio Stream exists but it's faulty. Not sure if MediaRouter should continue in this case. But you could handle this by catching the ret Error and just set the hasAudio = false and continue, eg:-

if (ret < 0 && ret != ffmpeg.AVERROR_STREAM_NOT_FOUND) { Log("Error[" + ret.ToString("D4") + "], Msg: " + ErrorCodeToMsg(ret)); hasAudio = false; }

I will probably included at the next update... Thanks for posting!

If you feel that there is still an issue there, feel free to re-open it!

@pubpy2015
Copy link
Author

Hi,

ret = SetupStream(AVMediaType.AVMEDIA_TYPE_AUDIO); always success and ret = 0.
This is video, you can try
20200710_174406.zip

@SuRGeoNix
Copy link
Owner

That seems to be a different issue, probably with demuxing or a codec issue. I'm planning to upgrade ffmpeg.cs in v1.3 with a better configuration for format contexts / codecs which i think will handle this kind of issues better.

My guess, is that issue with matroska (avi/mkv) format and because I use different format contexts for each media steam cannot handle properly the relationship (matroska tables) between streams. I tried to parse video stream as related to audio stream but didn't currently work:-

if (mType == AVMediaType.AVMEDIA_TYPE_AUDIO) { streamIndex = ffmpeg.av_find_best_stream(aFmtCtx, mType, -1, vStream->index, null, 0); }

So, I am afraid that this issue cannot be fixed until the ffmpeg.cs re-coding :(

@SuRGeoNix SuRGeoNix reopened this Jul 10, 2020
@SuRGeoNix
Copy link
Owner

SuRGeoNix commented Jul 10, 2020

OK, with further review found the issue. The audio stream even if exists has not frames at all and the Screamer will wait until it will fill the queue at least with AUDIO_MIN_QUEUE_SIZE forever so the following should fix the issue

MediaRouter.cs : Line 697

// Fill Queues at least with Min
while (isPlaying && vFrames.Count < VIDEO_MIX_QUEUE_SIZE || (decoder.hasAudio && aFrames.Count < AUDIO_MIX_QUEUE_SIZE && !decoder.isAudioFinish) || (decoder.hasSubs && sFrames.Count < SUBS_MIN_QUEUE_SIZE && !decoder.isSubsFinish ) ) 
     Thread.Sleep(20);

@pubpy2015
Copy link
Author

Thanks

SuRGeoNix added a commit that referenced this issue Jul 12, 2020
…gger (ctr + Left/Right)

 2. Subs / Audio Big Step Adjustement Added
 3. Removed Resizing Texture while unidle
 4. Torrent Media File List proper sorting (alphanumerical)
 5. Keyboard Shortcuts now support unicode (any keyboard layout)
 6. Fixing Issue #3
SuRGeoNix added a commit that referenced this issue Aug 25, 2021
…gger (ctr + Left/Right)

 2. Subs / Audio Big Step Adjustement Added
 3. Removed Resizing Texture while unidle
 4. Torrent Media File List proper sorting (alphanumerical)
 5. Keyboard Shortcuts now support unicode (any keyboard layout)
 6. Fixing Issue #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants