ffmpeg live transcoding faster alternative? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Is there any opensource alternative to ffmpeg and VLC to live video transcoding from HTTP streaming to RTMP or other?
ffmpeg caused my CPU (AMD 4.0GHZ 8Core) is loaded 100% with only 8 SD streams.
Thanks for help.
PS.
I think I don't need to transcode my video, I can also stream with something like http video proxy. Source is in HTTP streaming format, also I am under Linux.

Your question should be: "Is there any opensource alternative faster than ffmpeg".
And the answer is No.
If you dont need to transcode, add -acodec copy -vcodec copy to your command line

ffmpeg is flexible encoder you can tweak it much you like , it's up to encoding algorithm and Size VS Quality battle , I think now days X264 are more efficacy than it was before , the important tweaks with ffmpeg to speedup encoding is -preset the default is medium you can use fast or faster and watch the quality of your output video . I have live steaming video and I use this command
ffmpeg -loglevel 0 -thread_queue_size 32768 -re -i "http://sorce" -vcodec libx264 -preset fast -break_non_keyframes 1 -profile:v high444 -x264-params "nal-hrd=cbr" -b:v 260k -acodec aac -b:a 32k -map_metadata -1 -s 480x360 -f flv rtmp://localhost/hls/live
That for very low quality video ,
ffmpeg -loglevel 0 -thread_queue_size 32768 -re -i "http://source" -vcodec libx264 -preset fast -break_non_keyframes 1 -b:v 665k -profile:v high444 -x264-params "nal-hrd=cbr" -acodec aac -b:a 32k -map_metadata -1 -s 854x480 -f flv rtmp://localhost/hls/live
you will get better quality and viewable picture when increase -b:v value .
so it's up to you preferred network you can get much higher video quality with less CPU usage.

Related

ffmpeg - output 5.1 AAC without lowpass on the LFE channel

I'm trying to encode 6 arbitrary mono audio streams into a single AAC 5.1 track in an mp4 container (here with test streams):
ffmpeg -f lavfi -i testsrc=duration=10:size=100x100:rate=30 -f lavfi -i aevalsrc="-2+random(0)" -filter_complex "[1:a][1:a][1:a][1:a][1:a][1:a]join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-LFE|4.0-BL|5.0-BR[a]" -map '0:v' -map "[a]" -c:a aac -channel_layout 5.1 -t 10 testlfe.mp4
5 of the channels replicate the input audio just fine (modulo encoding). However, the LFE channel is lowpassed. Extracting with:
ffmpeg -i testlfe.mp4 -filter_complex "channelsplit=channel_layout=5.1:channels=LFE[LFE]" -map '[LFE]' testlfe.wav
I get a lowpassed rumble, instead of the original full white noise
(from ffmpeg -i testlfe.wav -lavfi showspectrumpic=s=640x320 testlfe.png)
Is there a way to prevent the lowpass from happening?
I couldn't find any references whether that's inherent to the AAC 5.1 encoding, something that ffmpeg does, or inherent to the decoding process. (I did decode my same test files using something that uses Microsoft MediaFoundation and the LFE channel was still lowpassed).
Turns out, the AAC codec inherently limits the LFE bandwidth, so there's no way around it.
(thanks to kesh in the comments) Wikipedia's Advanced Audio Encoding article claims the upper limit is 120Hz which matches my spectrogram, but doesn't cite a source. The actual ISO/IEC 13818-7:2006(en) Standard costs a bunch of money to read as usual, but in the free glossary there is an entry:
low frequency enhancement ( LFE ) channel:
limited bandwidth channel for low frequency audio effects in a multichannel system
Encode with
ffmpeg -i 6channels.wav -filter "channelmap=0|1|2|3|4|5:6.0(front)" -c:a libfdk_aac -ac 6 -profile:a aac_he -vbr 1 -cutoff 18000 -movflags +faststart 6channels-vbr1-fdk.m4a
It can also be done with regular aac codec.

Corrupted output when resizing with scale_npp filter ffmpeg

I'm trying to transcode a single video file into multiple variants with different
resolutions/bitrates using GPU acceleration - in one command.
The encoding/decoding part is working great and produces results as expected.
Main issue
However when I try to resize using the scale_npp filter things start to turn green.
The resulting output from ffmpeg is just a green image
Similar to Issue1,
Issue2 Already asked in ffmpeg forum but there is no answer for this issue
Command i am using for conversion
ffmpeg -y -vsync 0 -hwaccel cuvid -c:v h264_cuvid -i input.mp4 -vf scale_npp=1280:720 -c:a copy -c:v h264_nvenc -b:v 360k -hls_time 10 -hls_segment_filename output/ts_%03d.ts output/m3.m3u8
My output video showing like
https://i.stack.imgur.com/EbVfV.jpg
I appreciate your help.
Thanks

FFmpeg How to use alimiter Filter?

I cannot find enough documentation on the alimiter filter.
https://ffmpeg.org/ffmpeg-filters.html#alimiter
I used -filter_complex alimiter=limit=0.5 and it applied to the file but it boosted the volume.
I thought it was supposed to hardlimit the volume down?
FFmpeg says through cmd limit range [0.0625 - 1]
ffmpeg -i audio.wav -y -acodec libmp3lame -b:a 320k -ar 44100 -ac 2 -joint_stereo 1 -filter_complex alimiter=limit=0.5 audio.mp3
Here's a look at the two files through Adobe Audition
Original
FFmpeg alimiter 0.5
I found the problem was here:
level
Auto level output signal. Default is enabled. This normalizes audio back to 0dB if enabled.
I tried chaining the filter like this using level=disabled
-filter_complex alimiter=level_in=1:level_out=1:limit=0.5:attack=7:release=100:level=disabled
It now hard limits without raising the volume.

Problems with point to point streaming using FFmpeg

I want to live stream video from webcam and sound from microphone from one computer to another but there is some problems.
When I use this command line:
ffmpeg.exe -f dshow -rtbufsize 500M -i video="Camera":audio="Microphone" -c:v mpeg4 -c:a mp2 -f mpegts udp://127.0.0.1:1234
FFmpeg console starts filling with yellow color messages and stream becomes unstable: http://s16.postimg.org/qglcgr345/Untitled.png
To solve this problem I have added new parameter to the command line to set the frame rate -r 25:
ffmpeg.exe -f dshow -rtbufsize 500M -r 25 -i video="Camera":audio="Microphone" -c:v mpeg4 -c:a mp2 -f mpegts udp://127.0.0.1:1234
After I added -r 25 problem with yellow color messages disappears but then appears another problem. When I fresh start FFmpeg with this command line video and sound looks synchronous but after one or two minutes appears ~25 seconds lag between video and sound, sound goes behind video. I have tried that with different protocols UDP, TCP, RTP but problems are the same. Please help me!
I found answer for my problem with "-r" and asynchronous audio and video. Who is interested answer is here: https://trac.ffmpeg.org/wiki/DirectShow (in paragraph "Specifying input framerate").

adding repeated background audio with ffmpeg [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
With ffmpeg, I see how to add music file as background for a video, but the problem is how to make the audio loop/repeat. Is there a way out?
ffmpeg has the promising -loop_input flag, but it doesn't support audio inputs yet.
I'd recommend sox and the -shortest option for ffmpeg as a solution.
sox short_audio.mp3 looped_audio.mp3 repeat 1000 # adjust count as necessary
ffmpeg -i input_video.mp4 -i looped_audio.mp3 -shortest output_video.mp4
The sox command will loop the input, and the ffmpeg command will use it for the audio, but stop when it runs out of video to process.
I ran into the same problem and managed to do it by using ffmpeg and concat[enate] filter. Here is an example of how to loop it three times:
ffmpeg -i audio.wav -filter_complex "[0:a]afifo[a0];[0:a]afifo[a1];[0:a]afifo[a2];[a0][a1][a2]concat=n=3:v=0:a=1[a]" -map "[a]" out.wav
Edited (23/12/2020)
In addition to the above, another super easy 2 methods :
1st method : with audio output SIZE defined.
meaning : it will repeat / concatenate "MyAudio.mp3" till it reaches size of 10M and stop ( you will need to calculate end size yourself )
ffmpeg -stream_loop -1 -i "MyAudio.mp3" -fs 10M -c copy "MyRepeatingAudio.mp4"
2nd method : with NO output SIZE defined ( you will need to stop process, CTRL+C once it reaches required size
ffmpeg -stream_loop -1 -i "MyAudio.mp3" -c copy "MyRepeatingAudio.mp4"
Please note that above methods are also for REPEATING VIDEOS
3rd-party edit (15/09/2021)
This command adds repeating audio to a video in a single step:
ffmpeg -i input.mp4 -stream_loop -1 -i audio.mp4 -shortest \
-map 0:v:0 -map 1:a:0 -c:v copy output.mp4

Resources