Recording audio from mic and speakers from commandline
Hi, I am using ffmpeg version 2.4.7 on Fedora-21 workstation. I want to record audio, simultaneously from mic and speakers as separate streams. I am using the following command for it. ffmpeg -f alsa -i pulse -f alsa -i default -acodec libmp3lame -map 0:0 -map 1:0 outfile.mkv But after executing this command in terminal, I have to goto "Volume Control" settings in GUI, then goto "Recording" tab, change the "capture from" of one channel to "Built-in Audio Analog Stereo" (i.e., Mic) and the "capture from" of another channel to "Monitor of Built-in Audio Analog Stereo" (i.e., Speakers). But how can this be done completely from command-line, for automating it to use in scripts. - Mohan
Finally I found a way to achieve what I wanted, using the PulseAudio utility **"pacmd"**. $ pacmd list-sources|awk '/index:/ {print $0}; /name:/ {print $0}; /device\.description/ {print $0}' Run above command to get the indexes of all the system recording interfaces, with respect to PulseAudio. Sample output given below. index: 0 name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor> device.description = "Monitor of Built-in Audio Analog Stereo" * index: 1 name: <alsa_input.pci-0000_00_1b.0.analog-stereo> device.description = "Built-in Audio Analog Stereo" Run the following command to start recording using the ffmpeg application. $ ffmpeg -f alsa -i pulse -f alsa -i default -acodec libmp3lame -map 0:0 -map 1:0 outfile.mkv Now, get the indexes of the ffmpeg application interfaces, with respect to PulseAudio. Then set each of this 'application interface index' to the desired 'recording interface index'. $ pacmd list-source-outputs|tr "\n" " "| awk 'BEGIN {RS="index:"}; /application.process.binary = "ffmpeg"/ {print $0 }' |awk '{print "pacmd move-source-output " $1 " " (NR-1)}'|bash This solution works only when no other instance of "ffmpeg" is running on the system. The solution could have been better, if I could specify the recording-interfaces along with the "ffmpeg" command itself. Please let me know if it is possible. - Mohan
Hi all, I have some questions about the scaling algorithms in FFmpeg. https://www.ffmpeg.org/ffmpeg-scaler.html#sws_005fflags 1. Which is the default algorithm? 2. I have many pictures with resolution 5472x3648, which are combined to make a video with resolution 1800x1200. Any pixel in the video must be calculated from 3x3 pixels in the input pictures. The input pictures contain stars in the night sky which are slowly moving. Most stars are so small that they are just one pixel. If I use a "nearest neighbor" algorithm, then the star will blink on-off in the video. If I use any averaging algorithm, then the contrast will go down because the star is averaged with the dark neighbor pixels. Which is the best algorithm in this case? I need something like the maximum value out of the 3x3 neighborhood. 3. Please improve the documentation. For example: ‘experimental’ Select experimental scaling algorithm. Wow, that sounds interesting, but what does it do? Thanks, Michael -- ********************************************** ASTRO ELECTRONIC Dipl.-Ing. Michael Koch Raabestr. 43 37412 Herzberg www.astro-electronic.de Tel. +49 5521 854265 Fax +49 5521 854266 **********************************************
Dana 17. 10. 2015. 13:29 osoba "Michael Koch" <astroelectronic@t-online.de> napisala je:
Hi all,
I have some questions about the scaling algorithms in FFmpeg. https://www.ffmpeg.org/ffmpeg-scaler.html#sws_005fflags
1. Which is the default algorithm?
2. I have many pictures with resolution 5472x3648, which are combined to
The input pictures contain stars in the night sky which are slowly moving. Most stars are so small that they are just one pixel. If I use a "nearest neighbor" algorithm, then the star will blink on-off in the video. If I use any averaging algorithm, then the contrast will go down because
make a video with resolution 1800x1200. Any pixel in the video must be calculated from 3x3 pixels in the input pictures. the star is averaged with the dark neighbor pixels.
Which is the best algorithm in this case? I need something like the maximum value out of the 3x3 neighborhood.
That looks like the job for the filter, see inflate, deflate, erosion and dilation filters.
3. Please improve the documentation. For example: ‘experimental’ Select
experimental scaling algorithm.
Wow, that sounds interesting, but what does it do?
Thanks, Michael
-- ********************************************** ASTRO ELECTRONIC Dipl.-Ing. Michael Koch Raabestr. 43 37412 Herzberg www.astro-electronic.de Tel. +49 5521 854265 Fax +49 5521 854266 **********************************************
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
That looks like the job for the filter, see inflate, deflate, erosion and dilation filters.
I just tested the dilation filter. It's a nice workaround if the downscaling factor is 3:1, as in my example. But if the downscaling factor is smaller, for example from 5472x3648 to 900x600, which is 6:1, then it fails. The star would be visible in 50% of the frames and invisible in the other 50%. What I need is a scaling algorithm which automatically chooses the brightest pixel out of the corresponding pixels from the input file. If the downscaling factor is 6:1, then the neighborhood is 6x6 pixels. Michael
On Sat, Oct 17, 2015 at 3:58 PM Michael Koch <astroelectronic@t-online.de> wrote:
That looks like the job for the filter, see inflate, deflate, erosion and dilation filters.
I just tested the dilation filter. It's a nice workaround if the downscaling factor is 3:1, as in my example. But if the downscaling factor is smaller, for example from 5472x3648 to 900x600, which is 6:1, then it fails. The star would be visible in 50% of the frames and invisible in the other 50%. What I need is a scaling algorithm which automatically chooses the brightest pixel out of the corresponding pixels from the input file. If the downscaling factor is 6:1, then the neighborhood is 6x6 pixels.
See new morpho filter, that gonna be in master soon. It is much faster than current filters and allow custom definition of structure/mask (rectangle/circle/etc) by using 2nd stream.
Michael _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Am 20.09.2021 um 21:51 schrieb Paul B Mahol:
On Sat, Oct 17, 2015 at 3:58 PM Michael Koch <astroelectronic@t-online.de> wrote:
That looks like the job for the filter, see inflate, deflate, erosion and dilation filters.
I just tested the dilation filter. It's a nice workaround if the downscaling factor is 3:1, as in my example. But if the downscaling factor is smaller, for example from 5472x3648 to 900x600, which is 6:1, then it fails. The star would be visible in 50% of the frames and invisible in the other 50%. What I need is a scaling algorithm which automatically chooses the brightest pixel out of the corresponding pixels from the input file. If the downscaling factor is 6:1, then the neighborhood is 6x6 pixels.
See new morpho filter, that gonna be in master soon.
It is much faster than current filters and allow custom definition of structure/mask (rectangle/circle/etc) by using 2nd stream.
That sounds interesting. Is the size of the neighborhood over which the filter is working defined by the size of the 2nd stream? Which pixel format must be used for the 2nd stream? What's the meaning of the pixel values in the 2nd stream? White = pixel is used, black = pixel is not used? What happens if a pixel is gray? Is the original pixel in the center of the structure or is it the top left pixel? What's the meaning of "open" and "close"? Please add some examples for the structure in the 2nd stream. Michael
On Tue, Sep 21, 2021 at 8:31 AM Michael Koch <astroelectronic@t-online.de> wrote:
Am 20.09.2021 um 21:51 schrieb Paul B Mahol:
On Sat, Oct 17, 2015 at 3:58 PM Michael Koch < astroelectronic@t-online.de> wrote:
That looks like the job for the filter, see inflate, deflate, erosion and dilation filters.
I just tested the dilation filter. It's a nice workaround if the downscaling factor is 3:1, as in my example. But if the downscaling factor is smaller, for example from 5472x3648 to 900x600, which is 6:1, then it fails. The star would be visible in 50% of the frames and invisible in the other 50%. What I need is a scaling algorithm which automatically chooses the brightest pixel out of the corresponding pixels from the input file. If the downscaling factor is 6:1, then the neighborhood is 6x6 pixels.
See new morpho filter, that gonna be in master soon.
It is much faster than current filters and allow custom definition of structure/mask (rectangle/circle/etc) by using 2nd stream.
That sounds interesting. Is the size of the neighborhood over which the filter is working defined by the size of the 2nd stream?
No, but by structure of pixels which are not 0 in value and are stored in 2nd stream. So you can use rectangle 6x6 with color=color=white:size=6x6 filter or edit structure in gimp.
Which pixel format must be used for the 2nd stream?
Anything. What's the meaning of the pixel values in the 2nd stream? White = pixel
is used, black = pixel is not used? What happens if a pixel is gray? Is the original pixel in the center of the structure or is it the top left pixel? What's the meaning of "open" and "close"? Please add some examples for the structure in the 2nd stream.
Use google. and learn something about morphological transforms. FFmpeg can not also educate an uneducated.
Michael
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Am 21.09.2021 um 08:57 schrieb Paul B Mahol:
See new morpho filter, that gonna be in master soon.
It is much faster than current filters and allow custom definition of structure/mask (rectangle/circle/etc) by using 2nd stream.
I'd like to test it. Please push it.
What's the meaning of "open" and "close"? Please add some examples for the structure in the 2nd stream.
Use google. and learn something about morphological transforms. FFmpeg can not also educate an uneducated.
In such cases it would be useful to find in the filter's documentation a link to a site where it's explained, for example: https://en.wikipedia.org/wiki/Mathematical_morphology Michael
On Tue, Sep 28, 2021 at 10:11 PM Michael Koch <astroelectronic@t-online.de> wrote:
Am 21.09.2021 um 08:57 schrieb Paul B Mahol:
See new morpho filter, that gonna be in master soon.
It is much faster than current filters and allow custom definition of structure/mask (rectangle/circle/etc) by using 2nd stream.
I'd like to test it. Please push it.
What's the meaning of "open" and "close"? Please add some examples for the structure in the 2nd stream.
Use google. and learn something about morphological transforms. FFmpeg can not also educate an uneducated.
In such cases it would be useful to find in the filter's documentation a link to a site where it's explained, for example: https://en.wikipedia.org/wiki/Mathematical_morphology
You need whole encyclopedia and pictures.
Michael
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
The solution could have been better, if I could specify the recording-interfaces along with the "ffmpeg" command itself. Please let me know if it is possible.
After getting the names of all the system recording interfaces using "pacmd" and use them with ffmpeg. ffmpeg -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo -acodec libmp3lame -map 0:0 -map 1:0 outfile.mkv - Mohan
participants (3)
-
Michael Koch -
Mohan G -
Paul B Mahol