monasolutions / librtmfp Goto Github PK
View Code? Open in Web Editor NEWLGPL implementation of RTMFP (client part)
License: GNU Lesser General Public License v3.0
LGPL implementation of RTMFP (client part)
License: GNU Lesser General Public License v3.0
what is this?
I'm trying to publish big_buck_bunny, to a RTMFP NetGroup, with FFmpeg+librtfmp. When FFmpeg encounters big i-frames, it fails to publish, resulting bad images in Flash players.
./ffmpeg -re -i big_buck_bunny_720p_h264.mov -c:v libx264 -c:a aac -b:v 1000k --netgroup G:027f0201010103010c020e61011b00 -f flv rtmfp://<IPv6Address>:1935/live/test
Everything works well until a big i-frame occurs. Seems that librtmfp cannot transmit big user data chunk correctly, and fail to send big i-frames.
ffmpeg -i big_buck_bunny_720p_h264.mov -c:v libx264 -c:a aac -b:v 1000k -f flv test.flv
./TestClient --p2pWrite --url=rtmfp://<IPv6Address>/live/test --netgroup=G:027f0201010103010c020e61011b00 --logFile=testPubli.log --mediaFile=test.flv
Using your Flash VideoPlayer: http://raspi.monaserver.ovh/MonaClients/VideoPlayer/
TestClient repeatedly outputs DEBUG Main.c[176] Buffer too short, increasing...
And finally, when it encounters the first big i-frame, TestClient exits, with following log.
Players can not even see the river's flow.
11/16 15:37:01.3 DEBUG Main.c[176] Buffer too short, increasing...
11/16 15:37:01.4 DEBUG Main.c[176] Buffer too short, increasing...
11/16 15:37:01.4 ERROR Main.c[181] The current stream size is too long, exiting...
11/16 15:37:01.4 INFO Main.c[444] Closing connection...
11/16 15:37:01.4 INFO Invoker.cpp[404] Deleting connection 1...
11/16 15:37:01.4 INFO RTMFPSession.cpp[520] Deletion of the listener to G:027f0201010103010c020e61011b
11/16 15:37:01.4 INFO Publisher.cpp[99] Publication test stopped
11/16 15:37:01.4 INFO Invoker.cpp[353] Invoker memory release
11/16 15:37:01.4 NOTE Invoker.cpp[356] Invoker stopped
Video File: http://mirror.bigbuckbunny.de/peach/bigbuckbunny_movies/big_buck_bunny_720p_h264.mov
OS: Ubuntu 16.04 x64
Versions:
Do you have a sample for play rtmfp stream?
when I exceute such script below:
TestClient --p2pWrite --url=rtmfp://127.0.0.1:1985/live/G001 --netgroup=G:027f0201010103010c050e47313030011b00 --logFile=testPublihFlvGroup.log --mediaFile=1.flv
then I input params in http://raspi.monaserver.ovh/MonaClients/VideoPlayer/
url = rtmfp://127.0.0.1:1985/test123
groupName=G001
netgroupid=G:027f0201010103010c050e47313030011b00
then start connect
the log show below, it seems work ok,but I can not display video.
Initialization of the video player
Connection to 'rtmfp://127.0.0.1:1985' (stream name : test123)
NetConnection event : NetConnection.Connect.Success
Start playing stream test123
NetStream event : NetStream.Play.Reset
NetStream event : NetStream.Play.Start
Connection to 'rtmfp://127.0.0.1:1985' (stream name : test123)
NetConnection event : NetConnection.Connect.Closed
NetConnection event : NetConnection.Connect.Success
GroupSpec created : G:027f0201010103010c050e47313030011b00
NetConnection event : NetStream.Connect.Success
NetStream event : NetStream.Play.Reset
NetStream event : NetStream.Play.Start
NetConnection event : NetGroup.Connect.Success
NetGroup event : NetGroup.Neighbor.Connect
NetGroup event : NetGroup.MulticastStream.PublishNotify
When trying to build ffmpeg with librtmfp on a RaspberryPi 4 running Raspbian 10, configure gives me an error message telling me that librtmfp can not be found.
Manually checking the version using pkg-config returns a version number higher than the required version.
I simply followed the installation instructions. Is there anything I am missing?
Hi there, is it possible to compile librtmfp.a? I tried to compile ffmpeg as static
but obviously it needs librtmfp compiled as static too.
Thanks!
librtmp TestClient + Monaserver + http://raspi.monaserver.ovh/MonaClients/VideoPlayer/
./TestClient --p2pWrite --url=rtmfp://ip:1975/live/12 --netgroup=G:027f0201010103010c050e74657374011b00 --logFile=testPubli.log --mediaFile=out1.flv
play slowly
I just discovered a defect on ffmpeg builtin librtmp, I opened a ticket at ffmpeg bug tracker for this matter.
Description:
What about librtmfp? is it following the specs or has the same behavior of the ffmpeg builtin librtmp?
I'm stressing the rtmfp server by librtmfp. the main codes is:
int main(int argc,char * argv[]){
int flag = 1;
snprintf(url, sizeof(url), "%s", url_flv + 6); // url_flv is a address of a rtmfp server.
RTMFP_Init(&config, &groupConfig, 1);
config.pOnSocketError = onSocketError;
config.pOnStatusEvent = onStatusEvent;
config.isBlocking = groupConfig.isBlocking = 1;
RTMFP_InterruptSetCallback(IsInterrupted, NULL);
unsigned int context_keep = 0;
unsigned int context = 0;
context_keep = RTMFP_Connect(url, &config);
if (context_keep != 0) {
try_again:
context = RTMFP_Connect(url, &config);
if (context != 0) {
RTMFP_Close(context);
goto try_again;
} else {
RTMFP_Close(context_keep);
RTMFP_Terminate();
return -1;
}
}
RTMFP_Close(context_keep);
RTMFP_Terminate(); // To ensure that invoker is dead
printf("End of the Program!\n");
return 0;
The running result is:
RTMFPSession.cpp[847] Peer ID :
ff44c2d69a70c3f8a9740d418946bced3cbc320732744426663c99717aac3fa1
RTMFPSession.cpp[875] RTMFPSession is now connected to 123.103.16.146
Main.cpp[66] Status Event 'NetConnection.Connect.Success' : Connection succeeded
RTMFPSession.cpp[709] Sending peer info (port : 45426 - port ipv6 : 57390)
Invoker.cpp[93] Deleting connection 139...
Segmentation fault (core dumped)
I use gdb to debug it.
######################################################
gdb -c core.7015 ./TestClient
######################################################
Core was generated by `./TestClient'.
Program terminated with signal 11, Segmentation fault.
#0 0x00000039afb8fed8 in main_arena () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6_5.4.x86_64 keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-65.el6.x86_64 libcom_err-1.41.12-23.el6.x86_64 libgcc-4.4.7-18.el6.x86_64 libselinux-2.0.94-7.el6.x86_64 libstdc++-4.4.7-18.el6.x86_64 openssl-1.0.1e-57.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0 0x00000039afb8fed8 in main_arena () from /lib64/libc.so.6
#1 0x000000000044e982 in std::function<void ()()>::operator()() const ()
#2 0x000000000044e698 in Base::Event<void ()()>::operator=(Base::Event<void ()()> const&)::{lambda()#1}::operator()() const ()
#3 0x000000000044f0ed in _ZNSt17_Function_handlerIFvvEZN4Base5EventIS0_JEEaSERKS3_EUlvE_E9_M_invokeERKSt9_Any_data ()
#4 0x000000000044e982 in std::function<void ()()>::operator()() const ()
#5 0x000000000044e148 in _ZNK4Base5EventIFvvEJEEclEv ()
#6 0x00000000005270ab in Base::IOSocket::Send::Handle::handle(std::shared_ptr<Base::Socket> const&) ()
#7 0x0000000000526a69 in Base::IOSocket::Action::Handle::run(Base::Exception&) ()
#8 0x000000000044cfb3 in Base::Handler::flush(unsigned int) ()
#9 0x00000000004ad40f in Invoker::run(Base::Exception&, bool const volatile&) ()
#10 0x000000000046d5d4 in Base::Thread::process() ()
#11 0x0000000000471135 in _ZNKSt7_Mem_fnIMN4Base6ThreadEFvvEEclIJEvEEvPS1_DpOT_ ()
#12 0x0000000000471085 in _ZNSt12_Bind_simpleIFSt7_Mem_fnIMN4Base6ThreadEFvvEEPS2_EE9_M_invokeIJLm0EEEEvSt12_Index_tupleIJXspT_EEE ()
#13 0x0000000000470f83 in std::_Bind_simple<std::_Mem_fn<void (Base::Thread::*)()> ()(Base::Thread*)>::operator()() ()
#14 0x0000000000470f1c in std::thread::_Impl<std::_Bind_simple<std::_Mem_fn<void (Base::Thread::*)()> ()(Base::Thread*)> >::_M_run() ()
#15 0x0000003b16eb6470 in ?? () from /usr/lib64/libstdc++.so.6
#16 0x00000039afc079d1 in start_thread () from /lib64/libpthread.so.0
#17 0x00000039af8e886d in clone () from /lib64/libc.so.6
(gdb)
Hope you can reply
int main()
{
RTMFPConfig rtmfp;
RTMFPGroupConfig group;
unsigned int id;
short streamId;
char uri[100] = "rtmfp://vst.nemoface.com:1975/live/12";
static char* publication = NULL;
RTMFP_SetIntParameter("socketReceiveSize", 212992);
RTMFP_SetIntParameter("socketSendSize", 212992);
RTMFP_SetIntParameter("timeoutFallback", 8000);
RTMFP_SetIntParameter("logLevel", 6);
RTMFP_Init(&rtmfp, &group, 1);
rtmfp.pOnStatusEvent = onStatusEvent;
rtmfp.isBlocking = 1;
rtmfp.swfUrl = NULL;
rtmfp.app = NULL;
rtmfp.pageUrl = NULL;
rtmfp.flashVer = NULL;
rtmfp.host = NULL;
rtmfp.hostIPv6 = NULL;
printf("fdsa\n");
RTMFP_LogSetCallback(rtmfp_log);
/RTMFP_ActiveDump();
RTMFP_DumpSetCallback(rtmfp_dump);/
RTMFP_GetPublicationAndUrlFromUri(uri, &publication);
if ((id = RTMFP_Connect(uri, &rtmfp)) == 0)
return -1;
if (RTMFP_WaitForEvent(id, RTMFP_CONNECTED) == 0)
return -1;
printf("fdsa\n");
{
group.netGroup = "G:027f0201010103010c050e74657374011b00";
group.availabilityUpdatePeriod = 100;
group.windowDuration = 8000;
group.pushLimit = 4;
group.isPublisher = 1;
group.isBlocking = 1;
group.disableRateControl = 0;
streamId = RTMFP_Connect2Group(id, "12", &rtmfp, &group, 1, 1,NULL);
}
if (!streamId)
return -1;
static FILE *f =NULL;
static FILE *e =NULL;
static int header = 0;
static int pos = 0;
int size = 0;
char *size_temp;
size_temp = (char *)&size;
static char buf[100000];
int len;
if(f == NULL)f = fopen("receive.flv","rb+");
while(1)
{
if(header == 0)
{
printf("%d,%x\n",fread(buf,1,17,f),f);
*size_temp = buf[16];
*(size_temp +1) = buf[15];
*(size_temp +2) = buf[14];
printf("%d,%d\n",size,fread(buf+17,1,size + 4 + 7,f));
len = 17 + size + 4 + 7;
header = 1;
}
else
{
if( 0 >= fread(buf,1,4,f))
{
return 0;;// break;
}
*size_temp = buf[3];
*(size_temp +1) = buf[2];
*(size_temp +2) = buf[1];
if( 0 >= fread(buf + 4,1,size + 4 + 7,f))
{
return 0;// break;
}
len = 4 + size + 4 + 7;
}
int res = 0;
printf("%d,%x,%d\n",id, buf, len);
res = RTMFP_Write(id, buf, len);
usleep(66*1000);
}
}
I'm trying to compline this project in the docker, but it failed on creating the configuration for the ffmpeg.
ERROR: librtmfp not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
The command '/bin/sh -c ./configure --disable-x86asm --enable-librtmp --enable-librtmfp --enable-libspeex --enable-libx264 --enable-debug --enable-gpl && make' returned a non-zero code: 1
Here is my dockerfile:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y build-essential git pkg-config yasm
RUN apt-get install -y libssl-dev libx264-dev librtmp-dev libspeex-dev
RUN git clone https://github.com/MonaSolutions/librtmfp.git --depth=1
RUN git clone https://github.com/thomasjammet/FFmpeg.git --depth=1
RUN mkdir -p /usr/lib64
RUN mkdir -p /usr/local/lib/x86_64-linux-gnu/pkgconfig
WORKDIR /librtmfp
RUN make && make install
WORKDIR /FFmpeg
RUN ./configure --disable-x86asm --enable-librtmp --enable-librtmfp --enable-libspeex --enable-libx264 --enable-debug --enable-gpl && make
I change" hostAddress(IPAddress::IPv6) "to" hostAddress(IPAddress::IPv4) " and change " _id = ::socket(AF_INET6, type, 0);" to " _id = ::socket(AF_INET, type, 0);" but it is not OK.
Hi Thomas,
Hope you're fine! I just realized that Fedora 37 does not have openssl 1.1.x anymore, only openssl 3.x.
giving me some doubt about rtmfp protocol which need I guess for ever the openssl 1.1.x right?
so I installled a legacy openssl 1.1.x let's say in /usr/local/openssl-1.1 folder but how to compile with this path?
thanks
Seems it needs openssl as a dependency, might be nice to call that out in the INSTALL.md if it's the case...
I get
libavcodec/libavcodec.so: undefined reference to x264_bit_depth' libavcodec/libavcodec.so: undefined reference to
x264_encoder_open_152'
when --enable-libx264
any idea?
thanks
I planned to compile librtmfp on cygwin and use it with your ffmpeg fork
but I just saw on your INSTALL file that it's still not supported.
is it still on your roadmap?
thanks
As a note, I tried building this using mingw-w64 as "static" and ran into some build errors, Makefile, no instructions on how to make static, etc.
Here's what I ended up with
https://github.com/rdp/ffmpeg-windows-build-helpers/blob/master/patches/rtmfp.static.cross.patch
you can ignore the stuff about mingw threading, that's just because I hadn't built the compiler with builtin threading.
In addition, it's pretty hard to build a static library in linux/OS X today too, FWIW. Thanks!
Because linux is case sensitive, I get this failure:
sources/Base/IPAddress.cpp:22:10: fatal error: Iphlpapi.h: No such file or directory
(if I remove the capitalization it works fine). compiling on windows or OS X works OK though :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.