Closed HeidariMilad closed 2 years ago
swift run BuildFFmpeg
Thank you for response, I tried to build But unfortunately I have some errors.could you please help to resolve these issues as well?
MacOS 12.3 M1
Also tried arch -x86_64 swift run BuildFFmpeg
but result was same.
Errors:
error: unable to read the file at '/Users/milad/Downloads/KSPlayer-develop/Sources/BuildFFmpeg/Script/FFmpeg/ios/Libavfilter.framework/Libavfilter'
clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' make[1]: *** [apps/lib/libapps-lib-app_libctx.o] Error 1 make: *** [build_sw] Error 2 clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' make[1]: *** [apps/lib/libapps-lib-app_libctx.o] Error 1 make: *** [build_sw] Error 2
curl: (6) Could not resolve host: raw.githubusercontent.com yasm not found zsh:1: command not found: brew pkg-config not found zsh:1: command not found: brew
error: unable to read the file at '/Users/milad/Downloads/KSPlayer-develop/Sources/BuildFFmpeg/Script/SSL/maccatalyst/Libcrypto.framework/Libcrypto'
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /Users/milad/Downloads/KSPlayer-develop/Sources/BuildFFmpeg/Script/SSL/maccatalyst/thin/arm64/lib/Libcrypto.a (No such file or directory)
error: unable to read the file at '/Users/milad/Downloads/KSPlayer-develop/Sources/BuildFFmpeg/Script/SSL/maccatalyst/Libcrypto.framework/Libcrypto'
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /Users/milad/Downloads/KSPlayer-develop/Sources/BuildFFmpeg/Script/SSL/maccatalyst/thin/arm64/lib/Libssl.a (No such file or directory)
and some more like these.
you can update the code. i had fixed it
unfortunately getting new error this time. I will attach full log for you . log.docx
you need run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew was installed on my machine but still got "brew not found" error, and then by uninstalling it and installing using x86 architecture brew problem solved. but still doesn't build successfully, i will attach full log.
error: unable to read the file at '/Users/milad/Downloads/KSPlayer/Sources/BuildFFmpeg/Script/FFmpeg/ios/Libavfilter.framework/Libavfilter'
full log: log.docx
you need run
brew install yasm
brew install pkg-config
brew install sdl2
Thank you, I appreciate your time and effort. finally your default config built successfully.
now I added --enable-libsrt
to BuildXCFramework.swift
but finishes with error:
ERROR: srt >= 1.3.0 not found using pkg-config
you need to build srt. you can see the openssl
Ok, now I built it manually. And everything is ready in BuildFFmpeg folder. How do i use it? I tried replace xcframeworks. But when i want to play a srt stream i receive error in console, protocol not found, although frameworks successfully built with enabled srt.
what am I doing wrong? Have you ever tested srt protocol yourself?
you can get me the change of BuildXCFramework.swift. and get me the play url. i will try it
for changes please apply these patches: patches.zip
run swift run BuildFFmpeg
it will fail with ERROR: srt >= 1.3.0 not found using pkg-config
comment the line enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
in Scripts/ffmpeg-5.0.1/configure
run swift run BuildFFmpeg
And for SRT stream url I use FFMpeg for local streaming.you can do it like this:
ffmpeg -re -f lavfi -i "smptehdbars=rate=30:size=2048x1152" \ -vf drawtext="text='SRT Test : timecode= 01\:00\:00\:00':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=92:fontcolor=white:box=1:boxcolor=black" \ -f flv -c:v h264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 -g 60 -c:a aac -f mpegts "udp://127.0.0.1:1234?pkt_size=1316"
srt-live-transmit udp://:1234 srt://:4201 -v
now you can receive SRT stream on srt://127.0.0.1:4201
Have you any good news for me?
Have you any good news for me?
i had fixed it by 443fe834f91e837e7f84bfe233e5a0a4118277ca @MiladCyrus
fixed
Did you manage to play SRT stream? can you guid me step by step what you did? because I fail to play SRT stream.
you need run swift run BuildFFmpeg enable-openssl enable-libsrt
Thanks for the update. But I'm still unable to play srt stream. here is steps I done:
/ksplayer/Sources/BuildFFmpeg/Sources
with /ksplayer/Sources
AppDelegate
like this:
if let url = URL(string: "srt://192.168.1.102:4201") { let options = KSOptions() objects.append(KSPlayerResource(url: url, options: options, name: "srt video")) }
KSPlayer: KSPlayerLayer.swift:340 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSUnderlyingError=0x6000026bdcb0 {Error Domain=FFmpegDomain Code=-1330794744 "Protocol not found" UserInfo={NSLocalizedDescription=Protocol not found}}, NSLocalizedDescription=avformat can't open input}
this means despite building successfully and adding srt still KSPlayer doesn't recognise it and unable to play.
Thanks for the update. But I'm still unable to play srt stream. here is steps I done:
- replaced built xcframeworks in
/ksplayer/Sources/BuildFFmpeg/Sources
with/ksplayer/Sources
- ran a SRT stream as I mentioned in Adding SRT protocol on ffmpeg build #226 (comment)
- adde an Item in
AppDelegate
like this:if let url = URL(string: "srt://192.168.1.102:4201") { let options = KSOptions() objects.append(KSPlayerResource(url: url, options: options, name: "srt video")) }
- run the app and played the srt item. but I get this error in console:
KSPlayer: KSPlayerLayer.swift:340 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSUnderlyingError=0x6000026bdcb0 {Error Domain=FFmpegDomain Code=-1330794744 "Protocol not found" UserInfo={NSLocalizedDescription=Protocol not found}}, NSLocalizedDescription=avformat can't open input}
this means despite building successfully and adding srt still KSPlayer doesn't recognise it and unable to play.
can you play srt://127.0.0.1:4201 on vlc?
Thanks for the update. But I'm still unable to play srt stream. here is steps I done:
- replaced built xcframeworks in
/ksplayer/Sources/BuildFFmpeg/Sources
with/ksplayer/Sources
- ran a SRT stream as I mentioned in Adding SRT protocol on ffmpeg build #226 (comment)
- adde an Item in
AppDelegate
like this:if let url = URL(string: "srt://192.168.1.102:4201") { let options = KSOptions() objects.append(KSPlayerResource(url: url, options: options, name: "srt video")) }
- run the app and played the srt item. but I get this error in console:
KSPlayer: KSPlayerLayer.swift:340 finish(player:error:) | Error Domain=KSPlayerErrorDomain Code=2 "avformat can't open input" UserInfo={NSUnderlyingError=0x6000026bdcb0 {Error Domain=FFmpegDomain Code=-1330794744 "Protocol not found" UserInfo={NSLocalizedDescription=Protocol not found}}, NSLocalizedDescription=avformat can't open input}
this means despite building successfully and adding srt still KSPlayer doesn't recognise it and unable to play.
can you play srt://127.0.0.1:4201 on vlc?
Yes, It plays on vlc desktop. Vlc app on ios doesn't support SRT. if you want a srt player on ios device. You can use Haivision Play Pro.
@MiladCyrus
let srtPath = URL.currentDirectory + ["SRT", platform.rawValue, "thin", arch.rawValue]
if FileManager.default.fileExists(atPath: srtPath.path) {
cflags += " -I\(srtPath.path)/include"
ldflags += " -L\(srtPath.path)/lib"
ffmpegcflags.append("--enable-libsrt")
ffmpegcflags.append("--enable-protocol=libsrt")
}
do you had append("--enable-protocol=libsrt") ?
@MiladCyrus
let srtPath = URL.currentDirectory + ["SRT", platform.rawValue, "thin", arch.rawValue] if FileManager.default.fileExists(atPath: srtPath.path) { cflags += " -I\(srtPath.path)/include" ldflags += " -L\(srtPath.path)/lib" ffmpegcflags.append("--enable-libsrt") ffmpegcflags.append("--enable-protocol=libsrt") }
do you had append("--enable-protocol=libsrt") ?
Do you mean in swift run command? Or BuildXCframework.swift ?
After your update on repo i just ran swift run BuildFFmpeg enable-openssl enable-libsrt
BuildXCframework.swift
Enabled protocols:
async hls rtmpts
cache http rtp
concat httpproxy srtp
concatf https tcp
crypto libsrt tee
data pipe tls
ffrtmphttp prompeg udp
file rtmp udplite
ftp rtmps
gophers rtmpt
you can see the ffmpeg build log. search libsrt. Enabled protocols must have libsrt
OK. there is something wrong here. I have this in BuildXCframework.swift
if FileManager.default.fileExists(atPath: srtPath.path) {
cflags += " -I\(srtPath.path)/include"
ldflags += " -L\(srtPath.path)/lib"
ffmpegcflags.append("--enable-libsrt")
ffmpegcflags.append("--enable-protocol=libsrt")
}
but in logs there is no libsrt in protocols. here is the log of my last run: log.docx
by the way for convenience if you want we can discuss in some other messaging platforms like telegram or ...
you log not had --enable-libsrt and --enable-protocol=libsrt. so I guess FileManager.default.fileExists(atPath: srtPath.path) is false
Hi Firstly thank you for such a great player you have provided. I have a question. I want to add the SRT protocol at BuildXCFramework, but I can not run the builder, would you please kindly provide the information about the running your builder step by step? I will appreciate for your help