kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, SwiftUI, support subtitles.
https://apps.apple.com/app/tracyplayer/id6450770064
GNU General Public License v3.0
980 stars 197 forks source link

avformat can't open input - In test app it works, production app it doesn't #778

Closed bgoncal closed 5 months ago

bgoncal commented 5 months ago

Describe the bug I am experimenting with KSPlayer and some URL's, but I am facing a weird issue where the exact same code copied an pasted form my test app to my production app presents different results.

The test app can play the URL perfectly, but when I move the exact same code to the production app when I try to play the URL I get "avformat can't open input".

Other URL's work on both... usually VOD works fine on both, live content doesn't work in the production app.

To Reproduce Steps to reproduce the behavior:

  1. Described above, made a demo swiftui view and hardcoded one URL

Expected behavior Player perfoms the same on test and production app/

Screenshots If applicable, add screenshots to help explain your problem.

PNG image

Platform (please complete the following information):

Additional context Add any other context about the problem here. or Using FFmpeg to extract problematic video segments and upload them to GitHub.(ffmpeg -i http://xxx.com/123.mkv -map 0 -c copy -ss 00:00:50 -to 00:04:10 1.mkv)

bgoncal commented 5 months ago

Verbose logs

Cache loaded with 5598 pre-cached in CacheData and 64 items in CacheExtra.
Initializing NSHTTPCookieStorage singleton
Initializing CFHTTPCookieStorage singleton
Creating default cookie storage with default identifier
warning KSPlayer: KSAVPlayer.swift:415 prepareToPlay() | prepareToPlay KSPlayer.KSAVPlayer
AggregateDictionary is deprecated and has been removed. Please migrate to Core Analytics.
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> resuming, timeouts(60.0, 604800.0) QOS(0x21) Voucher (null)
[Telemetry]: Activity <nw_activity 12:2[F4FD19F2-19F5-4BEE-A254-3AE6368BB545] (reporting strategy default)> on Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> was not selected for reporting
Using HSTS 0x2821ab8f0 path file:///private/var/mobile/Containers/Data/Application/F17C934E-79F0-44AF-8540-B686725F984A/Library/Caches/com.panta.Home-TV/HSTS.plist
Initializing AlternativeServices Storage singleton
Garbage collection for alternative services
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> Alt-Svc entry found {speculative=false}
NW Proxies override 1 via os_feature
Connection 1: enabling TLS
Connection 1: starting, TC(0x0)
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> setting up Connection 1
Connection 1: asked to evaluate TLS Trust
[TLSCBQ] Need to invoke to satisfy trust callback
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> auth completion disp=1 cred=0x0
Connection 1: TLS Trust result 0
Connection 1: connected successfully
Connection 1: TLS handshake complete
Connection 1: ready C(N) E(N)
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> done setting up Connection 1
Connection 1: set is idle false
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> now using Connection 1
Connection 1: received viability advisory(Y)
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> sent request, body S 749
cannot migrate AudioUnit assets for current process
Metal GPU Frame Capture Enabled (/System/Library/PrivateFrameworks/GPUToolsCapture.framework/GPUToolsCapture)
Metal API Validation Enabled
warning KSPlayer: KSPlayerLayer.swift:93 player | player is <KSPlayer.KSMEPlayer: 0x283f918c0>
warning KSPlayer: KSMEPlayer.swift:375 prepareToPlay() | prepareToPlay <KSPlayer.KSMEPlayer: 0x283f918c0>
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> received response, status 200 content K
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> done using Connection 1
Connection 1: set is idle true
HTTP/2 Connection 1 Stream 1 ended successfully true
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> response ended
Task <CD2BC88F-133E-4DB9-9271-20C2A89FD558>.<1> finished successfully
Connection 1: cleaning up
Connection 1: done
warning KSPlayer: KSPlayerLayer.swift:141 state | playerStateDidChange - error
warning KSPlayer: KSPlayerLayer.swift:423 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSUnderlyingError=0x282e90d20 {Error Domain=KSPlayer.AVError Code=1 "(null)"}, NSLocalizedDescription=avformat can't open input}
bgoncal commented 5 months ago

Issue resolved, apparently it was some conflict with VLCKit, after keeping just KSPlayer the issue goes away