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
952 stars 193 forks source link

ffmpeg error #110

Closed UnknownCoder807 closed 3 years ago

UnknownCoder807 commented 3 years ago

Using the latest commit, no matter which video file I try to play I get the following issue :

KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - error
KSPlayer: KSPlayerLayer.swift:296 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSUnderlyingError=0x6000000c8660 {Error Domain=FFmpegDomain Code=-1094995529 "Invalid data found when processing input" UserInfo={NSLocalizedDescription=Invalid data found when processing input}}, NSLocalizedDescription=avformat can't open input}
kingslay commented 3 years ago

can you provide the play url?

UnknownCoder807 commented 3 years ago

It's the same issue with any video url, but I have sent you an email with a url that fails for me.

kingslay commented 3 years ago

I can play the url you provide in iOS simulator iPhone XS you can try to clean build folder

UnknownCoder807 commented 3 years ago

I have tried cleaning the build folder and also tried 2 different macbook pro's and get the same error.

I have built for simulator and real apple tv device and get the same error

here are some more logs

2021-01-22 14:28:28.568673+0000 myApp[826:158108]  ca_require: IsStreamFormatWritable(inScope, inElement) NotWritable
2021-01-22 14:28:28.586635+0000 myApp[826:158108] Metal GPU Frame Capture Enabled
2021-01-22 14:28:28.590138+0000 myApp[826:158108] Metal API Validation Enabled
KSPlayer: KSPlayerLayer.swift:81 player | player is KSPlayer.KSMEPlayer
KSPlayer: KSMEPlayer.swift:245 prepareToPlay() | prepareToPlay KSPlayer.KSMEPlayer
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - buffering
KSPlayer: KSAVPlayer.swift:413 pause() | pause KSPlayer.KSAVPlayer
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - paused
KSPlayer: KSPlayerLayer.swift:182 resetPlayer() | resetPlayer
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - notSetURL
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - error
KSPlayer: KSPlayerLayer.swift:296 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSLocalizedDescription=avformat can't open input, NSUnderlyingError=0x17eaa0f50 {Error Domain=FFmpegDomain Code=-1094995529 "Invalid data found when processing input" UserInfo={NSLocalizedDescription=Invalid data found when processing input}}}

Here is the code I am using to play the media, it's not changed for a long time and worked until the commits today, am I doing something wrong?

            guard let remoteURL = URL(string: "url goes here") else { return }

            let res0 = KSPlayerResourceDefinition(url: remoteURL, definition: "HD")
            asset = KSPlayerResource(name: "Test Video", definitions: [res0], cover: nil)
            playerView.set(resource: asset!)

            playerView.play()
kingslay commented 3 years ago

you can try the ksplay demo or try the url http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4

UnknownCoder807 commented 3 years ago

I have narrowed the issue down. If you also have TVVLCKit or MobileVLCKit in your Podfile then you get the issues above.

I have both VLC and KSPlayer in my app.

Without VLCKit installed, the latest commits work fine.

kingslay commented 3 years ago

you can try the latest commits f1ee795ae1dd33098aecc458e46485a0faed6c57

UnknownCoder807 commented 3 years ago

Thanks, but the issue is still there. I have tried cleaning the build folder again. I can send you a test project with both ksplayer and vlckit installed if you like, but you could easily do it by adding

Pod 'TVVLCKit' or Pod 'MobileVLCKit'

to your podfile.

UnknownCoder807 commented 3 years ago

Any idea if this can be fixed?

kingslay commented 3 years ago

I can not download TVVLCKit. [!] Error installing TVVLCKit [!] /usr/bin/curl -f -L -o /var/folders/81/hgr6tfx96lv6xyxd4n918jxh0000gp/T/d20210124-50209-1yw862s/file.txz https://download.videolan.org/cocoapods/prod/TVVLCKit-3.3.13-4145519-7df954cb.tar.xz --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.10.1 cocoapods-downloader/1.4.0'

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 343M 0 623k 0 0 3209 0 31:11:31 0:03:18 31:08:13 3783 curl: (18) transfer closed with 359704605 bytes remaining to read

UnknownCoder807 commented 3 years ago

Looks like it's trying to download an older version of TVVLCKit.

My Podfile looks like :

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'test new ksplayer' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for test new ksplayer
    pod "TVVLCKit"
    pod 'KSPlayer',:git => 'https://github.com/kingslay/KSPlayer.git', :branch => 'develop'
    pod 'FFmpeg',:git => 'https://github.com/kingslay/KSPlayer.git', :branch => 'develop'
    pod 'OpenSSL',:git => 'https://github.com/kingslay/KSPlayer.git', :branch => 'develop'

end
kingslay commented 3 years ago

Installing TVVLCKit (3.3.13)

UnknownCoder807 commented 3 years ago

I can email you a link to a test project with TVVLCKit 3.3.15 installed if needed.

wertpoiu commented 3 years ago

I can email you a link to a test project with TVVLCKit 3.3.15 installed if needed.

Please send him test project

UnknownCoder807 commented 3 years ago

I can email you a link to a test project with TVVLCKit 3.3.15 installed if needed.

Please send him test project

I will if he asks for it. I don't feel comfortable just emailing out the blue.

I can't imagine I'm the only person using both KSPlayer and VLCKit in the same project, so I think this is an important issue to fix, thanks.

kingslay commented 3 years ago

@UnknownCoder807 Yes you can emailing me the demo .

UnknownCoder807 commented 3 years ago

Sorry @kingslay but the issue still exists. Same errors in the test project.

kingslay commented 3 years ago

do you had cleaning the build folder? can you show the errors

UnknownCoder807 commented 3 years ago

I have cleaned the build folders and tried 2 macbook pro's. Real and Simulator, not working.

2021-01-26 08:21:54.733675+0000 myApp[1432:452720]  ca_require: IsStreamFormatWritable(inScope, inElement) NotWritable
2021-01-26 08:21:54.751484+0000 myApp[1432:452720] Metal GPU Frame Capture Enabled
2021-01-26 08:21:54.755201+0000 myApp[1432:452720] Metal API Validation Enabled
KSPlayer: KSPlayerLayer.swift:81 player | player is KSPlayer.KSMEPlayer
KSPlayer: KSMEPlayer.swift:245 prepareToPlay() | prepareToPlay KSPlayer.KSMEPlayer
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - buffering
KSPlayer: KSAVPlayer.swift:413 pause() | pause KSPlayer.KSAVPlayer
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - paused
KSPlayer: KSPlayerLayer.swift:182 resetPlayer() | resetPlayer
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - notSetURL
KSPlayer: KSPlayerLayer.swift:99 state | playerStateDidChange - error
KSPlayer: KSPlayerLayer.swift:296 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSUnderlyingError=0x17f401f90 {Error Domain=FFmpegDomain Code=-1094995529 "Invalid data found when processing input" UserInfo={NSLocalizedDescription=Invalid data found when processing input}}, NSLocalizedDescription=avformat can't open input}
kingslay commented 3 years ago

is Libavcodec or libavcodec? only the Libavcodec is true OTHER_LDFLAGS = $(inherited) -ObjC -l"bz2" -l"iconv" -l"xml2" -l"z" -framework "AVFoundation" -framework "AudioToolbox" -framework "FFmpeg" -framework "Foundation" -framework "KSPlayer" -framework "Libavcodec" -framework "Libavformat" -framework "Libavutil" -framework "Libcrypto" -framework "Libssl" -framework "Libswresample" -framework "Libswscale" -framework "UIKit" -framework "VideoToolbox" -weak_framework "MetalKit"

kingslay commented 3 years ago

I had update the code. you can try again @UnknownCoder807

UnknownCoder807 commented 3 years ago

Thanks @kingslay this has solved the issue for me.