Open isoloviev opened 7 years ago
Looks like version of FFMPEG is not compatible with this code
FFMPEG which version are you using?
If shared ffmpeg library libswscale.so is installed in your libdir (usually /usr/lib64) ?
Now, I'm using 3.2.2 version. But, I didn't receive video stream and image previews.
Error has gone, but looks like still doesn't work.
Also, I didn't receive any callbacks if TCP mode is off in RTSP client. Do you have ideas why?
I have changed artspclient.cpp to:
#define REQUEST_STREAMING_OVER_TCP True
After that I was able to receive callbacks in my script.
My output:
[mjpeg @ 0x7f5c080341e0] Specified pixel format -1 is invalid or not supported
avcodec_open2: ERROR: Could not open output codec
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Got a SDP description:
v=0
o=- 1485502058512992 1 IN IP4 10.0.1.9
s=Session streamed by "preview"
i=h264Preview_01_main
t=0 0
a=tool:LIVE555 Streaming Media v2013.04.08
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:Session streamed by "preview"
a=x-qt-text-inf:h264Preview_01_main
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=640033;sprop-parameter-sets=Z2QAM6zoAoALWQ==,aO48MA==
a=control:trackID=1
m=audio 0 RTP/AVP 8
c=IN IP4 0.0.0.0
b=AS:128
a=control:trackID=2
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Initiated the "video/H264" subsession (client ports 34056-34057)
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Set up the "video/H264" subsession (client ports 34056-34057)
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Created a data sink for the "video/H264" subsession
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Initiated the "audio/PCMA" subsession (client ports 60252-60253)
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Set up the "audio/PCMA" subsession (client ports 60252-60253)
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Created a data sink for the "audio/PCMA" subsession
[URL:"rtsp://10.0.1.9/h264Preview_01_main/"]: Started playing session...
BTW, I see the error in output codec:
[mjpeg @ 0x7f5c080341e0] Specified pixel format -1 is invalid or not supported
avcodec_open2: ERROR: Could not open output codec
That's why I don't have video stream
Also, I didn't receive any callbacks if TCP mode is off in RTSP client. Do you have ideas why?
Some cameras not supported streaming over UDP in RTSP mode
Could you show me your top-level javascript initialisation code of aStreamDecode object? I try to run test system with your configuration May be replace pixel format to AV_PIX_FMT_YUV420P in astreamdecode.cpp:66 solves this problem:
pOutCtx->pix_fmt = AV_PIX_FMT_YUV420P;
Some cameras not supported streaming over UDP in RTSP mode
So, I will add flag for that case. Thanks.
This is my script.
var camCount = 1;
process.env.UV_THREADPOOL_SIZE = 5 + camCount * 2;
h264stream = fs.createWriteStream("./out/stream.h264");
mpeg1stream = fs.createWriteStream("./out/stream.mpeg1video");
cam01 = new avr.aRTSPInput("rtsp://admin@10.0.1.9/h264Preview_01_main", "h264");
cam01decoder = new avr.aStreamDecode(1280, 720, 320, 180, "h264", 16, 8);
cam01decoder.needVideo(1);
cam01.start(function(buf, keyFrame) {
if (keyFrame) {
console.log("Got keyframe\n");
}
h264stream.write(buf);
cam01decoder.decode(buf);
});
cam01decoder.onPreview(function(buf) {
console.log("onPreview");
thumb = fs.writeFile("./out/frames/" + Date.now() + ".jpeg", buf);
});
cam01decoder.onVideo(function(buf) {
console.log("onVideo");
mpeg1stream.write(buf);
});
pOutCtx->pix_fmt = AV_PIX_FMT_YUV420P;
Still doesn't work.
I was add some error handling code, please try checkout project again and run your code. With latest ffmpeg 3.2.2 library and enabled all needed encoders and decoders error is absent.
> ffmpeg -encoders | grep -i mjpeg
VFS... mjpeg MJPEG (Motion JPEG)
> ffmpeg -decoders | grep -i h264
VFS..D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
./configure --prefix=/usr --enable-shared --shlibdir=/usr/lib64
make && make install
I have the following output:
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr/local --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --bindir=/usr/local/bin --disable-doc --disable-static --enable-shared --disable-ffplay --extra-libs=-ldl --enable-version3 --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-gpl --enable-avresample --enable-postproc --enable-nonfree --disable-debug --enable-small --enable-encoder=libx264 --enable-encoder=libx264rgb --enable-encoder=bmp --enable-encoder=png --enable-encoder=ljpeg --enable-decoder=h264 --enable-decoder=bmp --enable-decoder=png --enable-openssl
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
VFS... mjpeg
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr/local --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --bindir=/usr/local/bin --disable-doc --disable-static --enable-shared --disable-ffplay --extra-libs=-ldl --enable-version3 --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-gpl --enable-avresample --enable-postproc --enable-nonfree --disable-debug --enable-small --enable-encoder=libx264 --enable-encoder=libx264rgb --enable-encoder=bmp --enable-encoder=png --enable-encoder=ljpeg --enable-decoder=h264 --enable-decoder=bmp --enable-decoder=png --enable-openssl
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
VFS..D h264
Is it correct?
It is correct, try checkout project and show me your console output
[mjpeg @ 0x7f33000341e0] Specified pixel format -1 is invalid or not supported avcodec_open2: ERROR: Could not open output codec [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Got a SDP description: v=0 o=- 1487311229001498 1 IN IP4 10.0.1.5 s=Session streamed by "preview" i=h264Preview_01_main t=0 0 a=tool:LIVE555 Streaming Media v2013.04.08 a=type:broadcast a=control:* a=range:npt=0- a=x-qt-text-nam:Session streamed by "preview" a=x-qt-text-inf:h264Preview_01_main m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:500 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1;profile-level-id=640033;sprop-parameter-sets=Z2QAM6zoAoALWQ==,aO48MA== a=control:trackID=1 m=audio 0 RTP/AVP 8 c=IN IP4 0.0.0.0 b=AS:128 a=control:trackID=2
[URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Initiated the "video/H264" subsession (client ports 44004-44005) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Set up the "video/H264" subsession (client ports 44004-44005) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Created a data sink for the "video/H264" subsession [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Initiated the "audio/PCMA" subsession (client ports 38146-38147) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Set up the "audio/PCMA" subsession (client ports 38146-38147) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Created a data sink for the "audio/PCMA" subsession [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Started playing session... Fri Feb 17 2017 06:24:55 GMT+0000 (UTC) - Got keyframe
Try checkout project again and show me your console output
I tried with FFMPEG provided by you (default installation)
Here is the log:
[URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Got a SDP description: v=0 o=- 1487311229001498 1 IN IP4 10.0.1.5 s=Session streamed by "preview" i=h264Preview_01_main t=0 0 a=tool:LIVE555 Streaming Media v2013.04.08 a=type:broadcast a=control:* a=range:npt=0- a=x-qt-text-nam:Session streamed by "preview" a=x-qt-text-inf:h264Preview_01_main m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 b=AS:500 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1;profile-level-id=640033;sprop-parameter-sets=Z2QAM6zoAoALWQ==,aO48MA== a=control:trackID=1 m=audio 0 RTP/AVP 8 c=IN IP4 0.0.0.0 b=AS:128 a=control:trackID=2
[URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Initiated the "video/H264" subsession (client ports 54988-54989) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Set up the "video/H264" subsession (client ports 54988-54989) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Created a data sink for the "video/H264" subsession [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Initiated the "audio/PCMA" subsession (client ports 55134-55135) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Set up the "audio/PCMA" subsession (client ports 55134-55135) [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Created a data sink for the "audio/PCMA" subsession [URL:"rtsp://10.0.1.5/h264Preview_01_main/"]: Started playing session... [mjpeg @ 0x7f5d2c0341e0] Specified pixel format yuv420p is invalid or not supported avcodec_open2: ERROR: Could not open output codec for preview Fri Feb 17 2017 08:00:57 GMT+0000 (UTC) - Got keyframe
Fri Feb 17 2017 08:00:59 GMT+0000 (UTC) - Got keyframe
I returned line astreamdecode.cpp:66:
pOutCtx->pix_fmt = AV_PIX_FMT_YUVJ420P;
try checkout and show me console output again.
Also show me result of command (to determine, which pixel format need to defined in encoder setup):
ffmpeg -h encoder=mjpeg | grep pixel
Build is passed, but I've got the following error during start
node: symbol lookup error: /opt/avrmodule/build/Release/obj.target/avrmodule.node: undefined symbol: sws_getContext
node: symbol lookup error: /opt/avrmodule/build/Release/obj.target/avrmodule.node: undefined symbol: sws_getContext