ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.32k stars 5.33k forks source link

Windows: Support cygwin 64bits, native Windows and IDE #2532

Closed winlinvip closed 1 year ago

winlinvip commented 3 years ago

SRS for Windows

SRS 5.0.89+ supports Windows(Cygwin64).

Build from code

Please install Cygwin64.

Install packages gcc-g++ make automake patch pkg-config tcl cmake, please see packages.

Build SRS with cygwin terminal:

git checkout develop
./configure
make

If success, there should be a ./objs/srs.exe

Install from binary

For each release of SRS, from SRS 5.0.89, there is always a binary installer of SRS Windows, normally as the artifact of release, which allows you to install and run SRS very easy.

Bellow is some examples, note that you should always use the latest release, not the fixed one:

Note: SRS 5.0.89+ supports cygwin pipeline, to build and packge automatically by GitHub Actions.

image

Run SRS as administrator:

image

Publish to SRS Windows by FFmpeg:

ffmpeg -re -i ~/srs/doc/source.flv -c copy -f flv rtmp://win11/live/livestream

Play by VLC or srs-player

image

Most of SRS features are available in Windows, for example, RTMP, HTTP-FLV, HLS, WebRTC, HTTP-API, Prometheus Exporter, etc.

Package by NSIS

If want to package by NSIS, please run in cygwin terminal:

"/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" \
    /DSRS_VERSION=$(./objs/srs -v 2>&1) \
    /DCYGWIN_DIR="C:\cygwin64" \
    packaging/nsis/srs.nsi

Known Issues

Links

ST supports windows: https://github.com/ossrs/state-threads/issues/20

Commits about SRS Windows: https://github.com/ossrs/srs-windows/issues/2

Windows docker also works for SRS, however, srs.exe is more popular for windows developers.

chenjim commented 2 years ago

My environment WSL + Ubuntu should be more efficient than cygwin.

TRANS_BY_GPT3

290008282 commented 2 years ago

During the SRS installation process, SRS will be added to the Windows environment variables. Users can open the cmd console and directly launch SRS.

How to solve the issue of not adding system environment variables? What variables should be manually added?

TRANS_BY_GPT3

duliangheng commented 2 years ago

During the SRS installation process, SRS will be added to the Windows environment variables. Users can directly launch SRS by opening the cmd console.

How to solve the issue of not adding system environment variables? What variables should be manually added?

Mine also didn't add environment variables? Does everyone use Windows?

TRANS_BY_GPT3

290008282 commented 2 years ago

During the SRS installation process, SRS will be added to the Windows environment variables, allowing users to directly launch SRS by opening the cmd console. What if the system environment variables are not added? How can it be resolved? Manually add which variables?

Mine also does not have the environment variables added? Does everyone use Windows? I have already given up and am waiting for future updates. Currently, I find CentOS more stable to use.

TRANS_BY_GPT3

duliangheng commented 2 years ago

Have you ever compiled a Windows version? When I compile it, it stops executing with an error at 'Building ffmpeg-4-fit'...

TRANS_BY_GPT3

duliangheng commented 2 years ago

During the SRS installation process, SRS will be added to the Windows environment variables. Users can directly launch SRS by opening the cmd console. What should I do if I haven't added the system environment variables? How can I manually add the variables?

I also haven't added the environment variables. Does everyone use Windows? I have already given up and am waiting for future updates. Currently, I find CentOS more stable to use.

Have you ever compiled a Windows version? When I was compiling, I encountered two issues that prevented me from proceeding...

First issue: ./config Building libsrtp-2-fit. patching file crypto/math/datatypes.c Reversed (or previously applied) patch detected! Assume -R? [n]

This place, I don't know how to handle it?

Secondly, during the process of making. In file included from src/app/srs_app_threads.cpp:21: src/app/srs_app_rtc_dtls.hpp:16:10: fatal error: srtp2/srtp.h: No such file or directory 16 | #include <srtp2/srtp.h> | ^~~~~~ compilation terminated.

That's the end here.

TRANS_BY_GPT3

290008282 commented 2 years ago

I have not compiled the Windows version before. The actual released version can run normally, but there are some differences in the command slashes (\ and /) compared to the tutorial. My problem at that time was that the conf file configured in Linux could not run properly in the Windows version.

So I found an old computer and set up a local Linux server with the help of Baota. It's very convenient. Why do we have to use Windows? I don't know what your application environment is, but I use the Linux version to convert RTSP from an internal network camera to RTMP+.flv for external live streaming. It is very stable, and I haven't made any changes since I set it up. The speed is also good, and you can directly upload the public network service to the cloud. Lightweight servers are not expensive nowadays.

L.HF @.***

Rongcheng Yijie Network Technology Co., Ltd.

 

------------------ Original Message ------------------ From: "ossrs/srs" @.>; Sent: May 14, 2022 (Saturday) 7:57 PM @.>; @.**@.>; Subject: Re: [ossrs/srs] Windows: Support cygwin 64bits (#2532)

That being said, have you ever compiled the Windows version? When I tried to compile it, I encountered two issues that prevented further execution...

First issue: ./config Building libsrtp-2-fit. patching file crypto/math/datatypes.c Reversed (or previously applied) patch detected! Assume -R? [n]

In this situation, I'm not sure how to handle it.

The second issue is: When making, in the file src/app/srs_app_threads.cpp at line 21, there is an error. In the file src/app/srs_app_rtc_dtls.hpp at line 16, there is a fatal error: srtp2/srtp.h file or directory does not exist. The compilation is terminated.

And here it ends.

During the SRS installation process, SRS will be added to the Windows environment variables, allowing users to directly launch SRS from the cmd console. If the system environment variables are not added, how can this be resolved? What variables should be manually added?

I also didn't add the environment variables. Does everyone use Windows? I have already given up and am waiting for future updates. Currently, I find CentOS more stable to use.

So, may I ask if you have ever compiled a Windows version? When I was compiling, I encountered two issues that prevented me from proceeding...

First issue: ./config Building libsrtp-2-fit. patching file crypto/math/datatypes.c Reversed (or previously applied) patch detected! Assume -R? [n]

This place, I don't know how to handle it?

The second one: when making. In file included from src/app/srs_app_threads.cpp:21: src/app/srs_app_rtc_dtls.hpp:16:10: fatal error: srtp2/srtp.h: No such file or directory 16 | #include <srtp2/srtp.h> | ^~~~~~ compilation terminated.

That's the end here.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

TRANS_BY_GPT3

duliangheng commented 2 years ago

I have never compiled the Windows version before. The actual released version can run normally, but there are some differences in the command syntax between Linux and Windows. My problem at that time was that the conf file configured in Linux could not run properly in the Windows version. So I set up a local Linux server on an old computer with the help of Baota, which is very convenient. Why do you have to use Windows? I don't know what your application environment is, but I use the Linux version and it is very stable. I haven't made any changes since I set it up, and the speed is also good. Public network services can be directly deployed on the cloud, and lightweight servers are not expensive now. L.HF @.*** Rongcheng Yijie Network Technology Co., Ltd.

I just want to learn because I rarely use Linux, so I want to use it on Windows.

TRANS_BY_GPT3

puttys commented 2 years ago

During the SRS installation process, SRS will be added to the Windows environment variables, allowing users to directly launch SRS from the cmd console. What if the system environment variables are not added? How to manually add the variables?

Mine also doesn't have the environment variables added? Does everyone use Windows? I have already given up and will wait for future updates. Currently, using CentOS is more stable.

Have you ever compiled a Windows version? When I was compiling, I encountered two issues that prevented me from proceeding...

First issue: ./config Building libsrtp-2-fit. patching file crypto/math/datatypes.c Reversed (or previously applied) patch detected! Assume -R? [n]

At this location, I don't know how to handle it.

Second: When making, in file included from src/app/srs_app_threads.cpp:21: src/app/srs_app_rtc_dtls.hpp:16:10: fatal error: srtp2/srtp.h: No such file or directory 16 | #include <srtp2/srtp.h> | ^~~~~~ compilation terminated.

This is the end.

Manually compile 3rdparty\libsrtp-2-fit. Move the files under the include directory to objs\srtp2\include\srtp2. Move the compiled .a file to objs\srtp2\lib. Then run make again, it should work.

TRANS_BY_GPT3

winlinvip commented 1 year ago

Already merged commit:

commit e9503a9c9a4055a52a114f857a44c8d041fb0c1c Author: wenjie.zhao 740936897@qq.com Date: Fri Nov 18 23:02:35 2022 +0800

For #2532: Windows: Replace ln by cp for windows. v5.0.87 (#3246)

1. Replase ln by cp for windows.
2. Refine OS and CPU arch detecting.
3. Support configure from any directory by `SRS_WORKDIR`.
4. Support output to any directory by `SRS_OUTPUT`.
5. Disable sanitizer for gperf.
6. Use parallels build for make.
7. Refine bash variable check.