
Recherche avancée
Autres articles (62)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (7556)
-
Streaming RTP with ffmpeg and node.js to voip phone
5 juillet 2023, par Nik HendricksI am trying to implement SIP in node.js. Here is the library i am working on


Upon receiving an invite request such as



Received INVITE
INVITE sip:201@192.168.1.2:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.39:5062;branch=z9hG4bK1534941205
From: "Nik" <sip:nik@192.168.1.2>;tag=564148403
To: <sip:201@192.168.1.2>
Call-ID: 2068254636@192.168.1.39
CSeq: 2 INVITE
Contact: <sip:nik@192.168.1.39:5062>
Authorization: Digest username="Nik", realm="NRegistrar", nonce="1234abcd", uri="sip:201@192.168.1.2:5060", response="7fba16dafe3d60c270b774bd5bba524c", algorithm=MD5
Content-Type: application/sdp
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink SIP-T42G 29.71.0.120
Supported: replaces
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 306

v=0
o=- 20083 20083 IN IP4 192.168.1.39
s=SDP data
c=IN IP4 192.168.1.39
t=0 0
m=audio 11782 RTP/AVP 0 8 18 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:9 G722/8000
a=fmtp:101 0-15
a=rtpmap:101 telephone-event/8000
a=ptime:20
a=sendrecv




I can then parse the SDP into an object like this



{
 "session":{
 "version":"0",
 "origin":"- 20084 20084 IN IP4 192.168.1.39",
 "sessionName":"SDP data"
 },
 "media":[
 {
 "media":"audio",
 "port":11784,
 "protocol":"RTP/AVP",
 "format":"0",
 "attributes":[
 "rtpmap:0 PCMU/8000",
 "rtpmap:8 PCMA/8000",
 "rtpmap:18 G729/8000",
 "fmtp:18 annexb=no",
 "rtpmap:9 G722/8000",
 "fmtp:101 0-15",
 "rtpmap:101 telephone-event/8000",
 "ptime:20",
 "sendrecv"
 ]
 }
 ]
}



After sending the
100
and180
responses with my library i attempt to start a RTP stream with ffmpeg

var port = SDPParser.parse(res.message.body).media[0].port
var s = new STREAMER('output.wav', '192.168.1.39', port)



with the following STREAMER class


class Streamer{
 constructor(inputFilePath, rtpAddress, rtpPort){
 this.inputFilePath = 'output.wav';
 this.rtpAddress = rtpAddress;
 this.rtpPort = rtpPort;
 }

 start(){
 return new Promise((resolve) => {
 const ffmpegCommand = `ffmpeg -re -i ${this.inputFilePath} -ar 8000 -f mulaw -f rtp rtp://${this.rtpAddress}:${this.rtpPort}`;
 const ffmpegProcess = spawn(ffmpegCommand, { shell: true });
 
 ffmpegProcess.stdout.on('data', (data) => {
 data = data.toString()
 //replace all instances of 127.0.0.1 with our local ip address
 data = data.replace(new RegExp('127.0.0.1', 'g'), '192.168.1.3');

 resolve(data.toString())
 });
 
 ffmpegProcess.stderr.on('data', (data) => {
 // Handle stderr data if required
 console.log(data.toString())
 });
 
 ffmpegProcess.on('close', (code) => {
 // Handle process close event if required
 console.log('close')
 console.log(code.toString())
 });
 
 ffmpegProcess.on('error', (error) => {
 // Handle process error event if required
 console.log(error.toString())
 });
 })
 }
 
}



the
start()
function resolves with the SDP that ffmpeg generates. I am starting to think that ffmpeg cant generate proper SDP for voip calls.

so when i create
200
response with the following sdp

v=0
o=- 0 0 IN IP4 192.168.1.3
s=Impact Moderato
c=IN IP4 192.168.1.39
t=0 0
a=tool:libavformat 58.29.100
m=audio 12123 RTP/AVP 97
b=AS:128
a=rtpmap:97 PCMU/8000/2



the other line never picks up. from my understanding the first invite from the caller will provide SDP that will tell me where to send the RTP stream too and the correct codecs and everything. I know that currently, my wav file is PCMU and i can listen to it with ffplay and the provided sdp. what is required to make the other line pickup specifically a
Yealink t42g


my full attempt looks like this


Client.on('INVITE', (res) => {
 console.log("Received INVITE")
 var d = Client.Dialog(res).then(dialog => {
 dialog.send(res.CreateResponse(100))
 dialog.send(res.CreateResponse(180))
 var port = SDPParser.parse(res.message.body).media[0].port

 var s = new STREAMER('output.wav', '192.168.1.39', port)
 s.start().then(sdp => {
 console.log(sdp.split('SDP:')[1])
 var ok = res.CreateResponse(200)
 ok.body = sdp.split('SDP:')[1]
 dialog.send(ok)
 })

 dialog.on('BYE', (res) => {
 console.log("BYE")
 dialog.send(res.CreateResponse(200))
 dialog.kill()
 })
 })
})



I have provided a link to my library at the top of this message. My current problem is in the examples/Client folder.


I'm not sure what could be going wrong here. Maybe i'm not using the right format or codec for the VOIP phone i dont see whats wrong with the SDP. especially if i can listen to SDP generated by ffmpeg if i stream RTP back to the same computer i use
ffplay
on. Any help is greatly appreciated.

Update


As i test i decided to send the caller back SDP that was generated by a Yealink phone like itself. but with some modifications


v=0
o=- ${this.output_port} ${this.output_port} IN IP4 192.168.1.39
s=SDP data
c=IN IP4 192.168.1.39
t=0 0
m=audio ${this.output_port} RTP/AVP 0 8 18 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:9 G722/8000
a=fmtp:101 0-15
a=rtpmap:1
01 telephone-event/8000
a=ptime:20
a=sendrecv



Finally, the phone that makes the call in the first place will fully answer but still no audio stream. I notice if I change the IP address or port to something wrong the other phone Will hear its own audio instead of just quiet. so this leads me to believe I am headed in the right direction. And maybe the problem lies in not sending the right audio format for what I'm describing.


Additionaly, Whenever using
ffmpeg
to stream my audio with rtp I notice that it sees the file format as thispcm_alaw, 8000 Hz, mono, s16, 64 kb/s
My new SDP describes using both ulaw and alaw but I'm not sure which it is saying it prefers

v=0
o=- ${this.output_port} ${this.output_port} IN IP4 192.168.1.39
s=SDP data
c=IN IP4 192.168.1.39
t=0 0
m=audio ${this.output_port} RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=fmtp:101 0-15
a=rtpmap:101 telephone-event/8000
a=ptime:0
a=sendrecv



I have been able to simply the SDP down to this. This will let the other phone actually pickup and not hear its own audio. it's just a completely dead air stream.


-
ffmpeg rtmp live stream to Azure Media Services
18 mars 2015, par PilskalnsSomehow I got publishing Azure Media Services to work, except there is huge frame drop (almost every frame) with those settings :
ffmpeg -i "http://stream01/hls/live/playlist-mid.m3u8" -strict -2 -c:a aac -b:a 192k
-ar 44100 -r 25 -g 60 -keyint_min 60 -b:v 2000k -c:v libx264 -bufsize 2000k
-maxrate 2000k -f flv "rtmp://publishurl.working.is/mystream1"+ I can’t play URL from Azure.
When I publish to local nginx-rtmp server, frame drop stays and despite it I can play it. So, I believe that frame drop is ffmpeg related not Azure. Processor is not overloaded, available bandwidth is excellent.
When I try
original
settings from this URL (at very bottom), I this get additionaly this ffmpeg errorPast duration 0.719994 too large
Here’s more from output :
c:\ffmpeg\bin>ffmpeg -i "http://stream01/hls/live/playlist-mid.m3u8" -strict -2 -c:a aac -b:a 192k -ar 44100 -r 25 -g 60 -keyint_min 60 -b:v 2000k -c:
v libx264 -bufsize 1000k -maxrate 2000k -f flv "rtmp://********.channel.mediaservices.windows.net:1935/live/9590f0be/mystream1"
ffmpeg version N-69972-g6c91afe Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-l
ibrtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --ena
ble-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 19.100 / 54. 19.100
libavcodec 56. 25.100 / 56. 25.100
libavformat 56. 23.100 / 56. 23.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.100 / 5. 11.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, hls,applehttp, from 'http://stream01/hls/live/playlist-mid.m3u8':
Duration: N/A, start: 3314.605633, bitrate: N/A
Program 0
Metadata:
variant_bitrate : 1500000
Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 854x480 [SAR 1:1 DAR 427:240], 50 fps, 50 tbr, 90k tbn, 100 tbc
Metadata:
variant_bitrate : 1500000
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 216 kb/s
Metadata:
variant_bitrate : 1500000
[libx264 @ 0000000000306280] using SAR=1/1
[libx264 @ 0000000000306280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000000306280] profile High, level 3.0
[libx264 @ 0000000000306280] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 dead
zone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_in
tra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=60 keyint_min=31 scenecut=40 intra_refresh=0 rc_lookahea
d=40 rc=cbr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2000 vbv_bufsize=1000 nal_hrd=none filler=0 ip_ratio=1.
40 aq=1:1.00
Output #0, flv, to 'rtmp://*******.channel.mediaservices.windows.net:1935/live/37b4e25/mystream1':
Metadata:
encoder : Lavf56.23.100
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=-1--1, 2000 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
variant_bitrate : 1500000
encoder : Lavc56.25.100 libx264
Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 192 kb/s
Metadata:
variant_bitrate : 1500000
encoder : Lavc56.25.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[flv @ 0000000000305820] Failed to update header with correct duration.1.4kbits/s dup=0 drop=10697
[flv @ 0000000000305820] Failed to update header with correct filesize.
frame=10714 fps= 24 q=-1.0 Lsize= 100583kB time=00:07:11.08 bitrate=1911.4kbits/s dup=0 drop=10701
video:90024kB audio:10042kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.516478%
[libx264 @ 0000000000306280] frame I:190 Avg QP:10.58 size: 72438
[libx264 @ 0000000000306280] frame P:3406 Avg QP:14.32 size: 19296
[libx264 @ 0000000000306280] frame B:7118 Avg QP:19.55 size: 1784
[libx264 @ 0000000000306280] consecutive B-frames: 8.8% 4.4% 10.5% 76.3%
[libx264 @ 0000000000306280] mb I I16..4: 23.0% 20.2% 56.8%
[libx264 @ 0000000000306280] mb P I16..4: 2.7% 4.5% 5.2% P16..4: 41.9% 11.6% 8.7% 0.0% 0.0% skip:25.4%
[libx264 @ 0000000000306280] mb B I16..4: 0.1% 0.1% 0.2% B16..8: 26.5% 2.2% 0.5% direct: 3.2% skip:67.1% L0:51.0% L1:38.2% BI:10.8%
[libx264 @ 0000000000306280] 8x8 transform intra:31.3% inter:36.6%
[libx264 @ 0000000000306280] coded y,uvDC,uvAC intra: 80.5% 73.5% 51.1% inter: 16.1% 18.8% 5.8%
[libx264 @ 0000000000306280] i16 v,h,dc,p: 21% 29% 27% 23%
[libx264 @ 0000000000306280] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 32% 19% 4% 4% 4% 5% 4% 7%
[libx264 @ 0000000000306280] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 30% 15% 4% 5% 5% 5% 4% 5%
[libx264 @ 0000000000306280] i8c dc,h,v,p: 38% 30% 24% 8%
[libx264 @ 0000000000306280] Weighted P-Frames: Y:1.8% UV:0.4%
[libx264 @ 0000000000306280] ref P L0: 78.0% 8.5% 10.1% 3.3% 0.0%
[libx264 @ 0000000000306280] ref B L0: 91.3% 7.9% 0.8%
[libx264 @ 0000000000306280] ref B L1: 95.4% 4.6%
[libx264 @ 0000000000306280] kb/s:1716.97
Received signal 2: terminating. -
Panasonc GH5 4K 10 Bit 25p (cannot allocate memory)
25 novembre 2017, par SebastianI am converting GH5 files with the following script. With my Notebook I get no error and it goes through but at my desktop workstation I get this error. Anybody an idea. I convert 4K 10Bit Panasonic GH5 files to AVID HQX files. No error at the notebook but the desktop pc produces this error message. OS is windows 7 just new installed because of this. Same MeGUI and FFMPEG version and development server.
enter code here
D:\Test>for %f in (*.mov) do "C:\Program Files (x86)\MeGUI\tools\ffmpeg\ffmpeg.e
xe" -i "%~f" -c:a pcm_s16le -c:v dnxhd -profile:v dnxhr_hqx "%~nf_test.mov"
D:\Test>"C:\Program Files (x86)\MeGUI\tools\ffmpeg\ffmpeg.exe" -i "P1011064.MOV"
-c:a pcm_s16le -c:v dnxhd -profile:v dnxhr_hqx "P1011064_test.mov"
ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopu
s --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --ena
ble-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-lib
x264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-z
lib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-c
uvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-l
ibmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 005a7860] decoding for stream 0 failed
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'P1011064.MOV':
Metadata:
major_brand : qt
minor_version : 537986816
compatible_brands: qt pana
creation_time : 2017-11-19T16:16:23.000000Z
com.panasonic.Semi-Pro.metadata.xml: <?xml version="1.0" encoding="UTF-8" st
andalone="no" ?>
: <clipmain xmlns="urn:schemas-Professional-Plug-in:Semi-Pro:ClipMetadata:v1.0">
: <clipcontent>
: <globalclipid>060A2B340101010501010D2113000000171BA845
E82C2C3470010E90B8D50052</globalclipid>
: <duration>84</duration>
: <editunit>1/25</editunit>
: <essencelist>
: <video>
: <codec bitrate="150">H264_422_LongGOP</codec>
: <activeline>2160</activeline>
: <activepixel>3840</activepixel>
: <bitdepth>10</bitdepth>
: <framerate>25p</framerate>
: <timecodetype>NonDrop</timecodetype>
: <starttimecode>07:12:44:18</starttimecode>
: </video>
: <audio>
: <channel>2</channel>
: <samplingrate>48000</samplingrate>
: <bitspersample>16</bitspersample>
: </audio>
: </essencelist>
: <clipmetadata>
: <rating>0</rating>
: <access>
: <creationdate>2017-11-19T16:16:23+02:00
: <lastupdatedate>2017-11-19T16:16:23+02:00
: </lastupdatedate></creationdate></access>
: <device>
: <manufacturer>Panasonic</manufacturer>
: <modelname>DC-GH5</modelname>
: </device>
: <shoot>
: <startdate>2017-11-19T16:16:23+02:00</startdate>
: </shoot>
: </clipmetadata>
: </clipcontent>
: <userarea>
: <acquisitionmetadata xmlns="urn:schemas-Professional-P
lug-in:P2:CameraMetadata:v1.2">
: <cameraunitmetadata>
: <gamma>
: <capturegamma>CINELIKE_D</capturegamma>
: </gamma>
: <gamut>
: <capturegamut>BT.709</capturegamut>
: </gamut>
: </cameraunitmetadata>
: </acquisitionmetadata>
: </userarea>
: </clipmain>
:
Duration: 00:00:03.36, start: 0.000000, bitrate: 174710 kb/s
Stream #0:0(und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p10le(
tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 147582 kb/s, 25 fps, 25 tbr, 90k tbn,
50 tbc (default)
Metadata:
creation_time : 2017-11-19T16:16:23.000000Z
timecode : 07:12:44:18
Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s1
6, 1536 kb/s (default)
Metadata:
creation_time : 2017-11-19T16:16:23.000000Z
timecode : 07:12:44:18
Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2017-11-19T16:16:23.000000Z
timecode : 07:12:44:18
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> dnxhd (native))
Stream #0:1 -> #0:1 (pcm_s16be (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[dnxhd @ 0542fe60] Cannot allocate memory.
[dnxhd @ 04d508a0] ff_frame_thread_encoder_init failed
Error initializing output stream 0:0 -- Error while opening encoder for output s
tream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
D:\Test>pause
Drücken Sie eine beliebige Taste . . .