Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
varying RTP stream result from custom SIP implementation
1er février, par Nik HendricksI am in the process of creating my own SIP implementation in Node.js. As well as a b2bua as a learning project.
Finding people wise in the ways of SIP has proved to be difficult elsewhere but here I have had good results
this is the GitHub of my library so far node.js-sip
this is the GitHub of my PBX so far FlowPBX
Currently, everything is working as I expect. Although I really have some questions on possible errors in my implementation.
My main issue is with RTP streams. Currently I am utilizing ffmpeg.
my function goes as follows
start_stream(call_id, sdp){ console.log('Starting Stream') let port = sdp.match(/m=audio (\d+) RTP/)[1]; let ip = sdp.match(/c=IN IP4 (\d+\.\d+\.\d+\.\d+)/)[1]; let codec_ids = sdp.match(/m=audio \d+ RTP\/AVP (.+)/)[1].split(' '); let ffmpeg_codec_map = { 'opus': 'libopus', 'PCMU': 'pcm_mulaw', 'PCMA': 'pcm_alaw', 'telephone-event': 'pcm_mulaw', 'speex': 'speex', 'G722': 'g722', 'G729': 'g729', 'GSM': 'gsm', 'AMR': 'amr', 'AMR-WB': 'amr_wb', 'iLBC': 'ilbc', 'iSAC': 'isac', } let codecs = []; sdp.split('\n').forEach(line => { if(line.includes('a=rtpmap')){ let codec = line.match(/a=rtpmap:(\d+) (.+)/)[2]; let c_id = line.match(/a=rtpmap:(\d+) (.+)/)[1]; codecs.push({ name: codec.split('/')[0], rate: codec.split('/')[1], channels: codec.split('/')[2] !== undefined ? codec.split('/')[2] : 1, id: c_id }) } }) console.log('codecs') console.log(codecs) let selected_codec = codecs[0] if(selected_codec.name == 'telephone-event'){ selected_codec = codecs[1] console.log(selected_codec) } //see if opus is available codecs.forEach(codec => { if(codec.name == 'opus'){ selected_codec = codec; } }) if(selected_codec.name != 'opus'){ //check if g729 is available codecs.forEach(codec => { if(codec.name == 'G729'){ selected_codec = codec; } }) } console.log('selected_codec') console.log(selected_codec) let spawn = require('child_process').spawn; let ffmpegArgs = [ '-re', '-i', 'song.mp3', '-acodec', ffmpeg_codec_map[selected_codec.name], '-ar', selected_codec.rate, '-ac', selected_codec.channels, '-payload_type', selected_codec.id, '-f', 'rtp', `rtp://${ip}:${port}` ]; let ffmpeg = spawn('ffmpeg', ffmpegArgs); ffmpeg.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); ffmpeg.stderr.on('data', (data) => { console.error(`stderr: ${data}`); }); }
When using zoiper to test it works great. I have seen the mobile version negotiate speex and the desktop version negotiate opus mostly for the codec.
today I tried to register a grandstream phone to my pbx and the rtp stream is blank audio. opus is available and I have tried to prefer that in my stream but still even when selecting that I cannot get audio to the grandstream phone. This is the same case for a yealink phone. I can only get zoiper to work so far.
what could be causing this behavior? there is a clear path of communication between everything just like the zoiper client's I have used.
Additionally in my sip implementation, how important is the concept of a dialog? currently, I just match messages by
Call-ID
and then choose what to send based on the method or response. is there any other underlying dialog functionality that I may need to implement?
It would just be awesome to get someone who really knows what they are talking about eyes on some of my code to direct this large codebase in the right direction but I realize that a big ask lol.
-
Average set of 5 frames into single output frames
1er février, par xnxI would like to average the values of sequences of frames into a single output frames. I think this would be the ffmpeg tmix filter, but I can't find the right setting.
Example behavior:
Input video frames: 1,2,3,4,5 -> Output video frame: 1 Input video frames: 6,7,8,9,10 -> Output video frame: 2 Input video frames: 11,12,13,14,15 -> Output video frame: 3 etc.
How could I do this with ffmpeg, or any other tool?
-
How to Use Temporal and Spatial Scalability with SVT-AV1 in FFMPEG ?
31 janvier, par MRezaI am working with
SvtAv1EncApp
to see the impact of temporal and spatial scalability.I have successfully compiled the codec provided in https://gitlab.com/AOMediaCodec/SVT-AV1/ and built it with FFMPEG.
I would like to encode my
*.yuv
uncompressed video file with scalable bitstream notably with onebase layer
+ one or multipleenhancement layers
(both temporal and spatial if possible).Then by
-oppoint
option provided by https://ffmpeg.org/ffmpeg-codecs.html#Options-30 would show me the quality difference at the decoder side. However, I do not know how to encode and decode properly notably with FFMPEG to first get the scalable bitstream and then partially decode the bitstream.Below you can see the script I used for encoding and decoding; although, generates the output but it seems like it does not have scalable bitstream.
Encoding
./SvtAv1EncApp -i ./Dauntless_30-010/x1.yuv --frames 1800 -w 1920 -h 1080 --hierarchical-levels 3 -b output_scalable_av1.ivf
Decoding
ffmpeg -c:v libdav1d -oppoint 1 -i output_scalable_av1.ivf output_layer1.mp4
Could someone help me with this?
-
Scalable Webinar Features Using Open-Source Tools ? [closed]
31 janvier, par Firas Ben saidI am searching for a scalable webinar solution that can handle 1000+ concurrent users. I have explored platforms like BigBlueButton but encountered limitations with scalability in real-world scenarios.
My requirements include:
- Support for RTMP and HLS streaming.
- Chat and screen-sharing functionalities.
- Ability to integrate with custom APIs.
I’d like to know how to address these challenges using open-source tools. For instance:
- What configurations are necessary to scale tools like BigBlueButton for large audiences?
- Are there specific architectural patterns or server setups recommended for handling this user load?
Any guidance or examples would be appreciated.
-
Moviepy V2 How do you position a TextClip and apply an effect ?
31 janvier, par BrandonI am trying to refactor my code to use the new Moviepy Version 2.0 and I'm having trouble with .with_position / SlideIn / SlideOut effect.
When I apply the SlideIn effect it seems to override any position I have applied. It there a way to explicitly set the position of a TextClip and apply a SlideIn and SlideOut effect without using nested CompositeVideoClip?
In the below example the with_position((0,0)) would not be implemented and the position of the TextClip would revert to the default centred position. If I remove the lines .with_effect... then the TextClip would be positioned as expected in the 0,0 location.
Any help would be much appreciated.
from moviepy import * clips = [] clip = ImageClip("path1.png", duration=3).with_start(0) clips.append(clip) title = TextClip("path3.ttf", text="Text...", font_size=80, color="#fff", text_align="center", duration=1,) title = title.with_start(1).with_position((0,0)) title = title.with_effects([vfx.SlideIn(0.25, "left")]) title = title.with_effects([vfx.SlideOut(0.25, "left")]) clips.append(title) final_clip = CompositeVideoClip(clips) final_clip.write_videofile("final_clip.mp4")
*EDIT To get the expected behaviour I need to use multiple nested CompositeVideoClips but this significantly slows it down. Is there anyway that I can make this code more efficient?
from moviepy import * clips = [] clip = ImageClip("path1.png", duration=3).with_start(0) clips.append(clip) title = TextClip("path3.ttf", text="Text...", font_size=80, color="#fff", text_align="center", duration=1,) title = CompositeVideoClip(title.with_effects([vfx.SlideIn(0.25, "left")])) title = CompositeVideoClip(title.with_effects([vfx.SlideOut(0.25, "left")])) title = title.with_start(1).with_position((0,0)) clips.append(title) final_clip = CompositeVideoClip(clips) final_clip.write_videofile("final_clip.mp4")