Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Extracting segment from MTS video without re-rendering and get thin changing color band on top of output
2 février, par DavidExtracting segment from .MTS video without re-rendering (for speed) and get a thin changing multi-color band on top of output. There is no band on the original video. How can this be prevented?
I used the following commands:
set i="" set o="
-
How to fix 'ffmpeg server returned 403 forbidden (access denied) ?
1er février, par peppahI'm writing a website to convert youtube videos using NodeJS. I am using a package to convert them (horizon-youtube-mp3). The package works, however, I'm having problems converting. Whenever I try to convert a youtube link, it will return 'server returned 403 forbidden access'. This error happens in 95% of the links. Some links actually work and convert correctly, but only a few.
I tried running the script on 3 different computers running 3 different OS's. My VPS, my laptop and my home PC. I looked on the web but couldn't find anything useful.
So yeah, I completely suck since I really don't understand why one video would convert, and the other won't. Even if the region of the video is the same.
Any help would be highly appreciated!
-
How to check if video have visually corrupted frames ?
1er février, par B LoloI'm using ffmpeg to convert and analyze video, mostly avi to mkv. Sometimes video that I work on have one frame corrupted in random place, , it looks like:
How to check if frame is visually corrupted in ffmpeg?
It's not file corruption (not byte corruption), I know that because this video artifact is present in source file, it's just visual corruption.
This command line gives error free result: ffmpeg -i myinput.avi {params} out.mkv 2> error_log.txt
How to find if similar pattern is on any more frames in video file? Can something from signalstats could be helpful?
-
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?