I am trying to record 2 different microphones through Sox for one of my application. I am currently just testing on Mac terminal for the audio recording. However, I am only able to get audio through one microphone.
The sox command I am using is:
sox -b 32 -e unsigned-integer -r 96k -c 2 -d --clobber --buffer $((96000*2*10)) /tmp/soxrecording.wav trim 0 10
Which give me a good .wav file.
I have two different usb microphones which show up as 2 channel I/p each in Sound/System Preferences. I tried to do -c 4 with the sox command to record from both microphones.
sox -b 32 -e unsigned-integer -r 96k -c 4 -d --clobber --buffer $((96000*2*10)) /tmp/soxrecording.wav trim 0 10
However, I get a warning saying;
sox WARN formats: can't set 4 channels; using 2
And I can just get audio in from only one usb microphone. I have been trying to fiddle and understand what’s wrong but any hints would be really helpful.
You need to specify that you are using ALSA, then run two different SOX command and have to specify the hardware you use for each one.
Please refer to soc, play, rec man page, basically you may use the -d, --default-device parameter when starting your command to specify which device you want to use.
Something like (simplified):
sox -r 44100 -c 2 -e s -t alsa hw:4,0 -d
sox -r 44100 -c 2 -e s -t alsa hw:3,0 -d
This page and this page may also help you.
Related
My team accidentally on purpose clicked NO when Audacity asked to save the recording. So I left with bunch of *.au files, after using recovery program.
Some of them did have header and still open-able with audacity itself (example : this one), and some other are just complete nonsense, sometimes having the header filled with text from random javascript or HTML code (like this one). Probably hard disk half overwritten with browser cache? I don't know. And at this point, I almost don't care.
The audacity is on default settings, with sample rate 44100Hz. I can open a-113.au using audacity, from standard open files. I also was able to achieve open files using "Open RAW files" from Audacity, using this settings :
so I assume header takes 12384 bytes.
Now, how do I trim 12384 bytes from the file when opened as RAW, with either SoX or ffmpeg? because if I open it as RAW with 0 offset (default settings), it will add the header as a noise.
Current ffmpeg command I used : ffmpeg.exe -f f32le -ar 44.1k -ac 1 -i source destination
Current sox command I used : sox -t raw --endian little --rate 44100 -b 1 -b 32 --encoding floating-point %%A "converted/%%~nxA.wav"
Both still have header as a noise in the converted files.
With ffmpeg, use the subfile protocol.
ffmpeg.exe -f f32le -ar 44.1k -ac 1 -start 12384 -i "subfile:source" destination
I am trying to record a stream here on my machine to study ffmpeg library,
but with(out) success.
I have a file watcher to clean up bugged streams, that cleanup each 3 minutes files that have been not changed less then 3 minutes.
The real problem is, if I use the command below:
/usr/bin/ffmpeg -i http://sysrad.net:10090/ -y test.mp3
this command doesn't have any kind of codec or audio transformation, so my target file (test.mp3) become 256k quickly, but, if I use this command below:
/usr/bin/ffmpeg -i http://sysrad.net:10090/ -y -b:a 8k -ac 1 -ar 11025 test.mp3
My target file (test.mp3) keep 0k until the record has 256k, I am not sure if this is an Unix problem or ffmpeg problem.
Other information, if I run in loop:
while true; do wc -l teste.mp3; sleep 0.5; done;
test.mp3 file keeps 0 rows, until has 256k size...
I have no idea how to workaround that, to get the real time file size for each 1k that ffmpeg get from stream with those codecs, does you guys have any idea how can I handle that?
Thanks!!!!
I need to cut parts from an audio file from position to position. When I tried this command
ffmpeg -ss 132 -t 139 -i original.mp3 new.mp3
it started at the second 132, and added the next 139 seconds to the new file.
What I need is from second 132 to second 139.
And when I tried
ffmpeg -ss 132 -to 139 -i original.mp3 new.mp3
it gives me an error:
Unrecognized option 'to'
Failed to set value '139' for option 'to'
(I don't want to tell how many seconds to take, just from/to).
--
I have ffmpeg version 0.8.20-6:0.8.20-0+deb7u1 (built on Jan 19 2017 11:13:36 with gcc 4.7.2). And when I try to update it (apt-get install ffmpeg), it tells me "ffmpeg is already the newest version".
With FFmpeg the ordering of parameters is significant. All of the parameters that come directly before an input will apply to that input. The same is true for an output... the parameters directly before it apply to the output.
Consider this command line:
ffmpeg -ss 132 -i input.mp3 output.mp3
-ss is the parameter to seek, so FFmpeg will seek the input file to 132 seconds in and treat that effectively at 00:00:00. The rest of your FFmpeg commands relative to the output don't know or care where that input came from or how it was seeked. Therefore, when you use -to or -t, the times or lengths given need to be relative to the input. That is, if you want seconds 132 through 139, you want to seek the input to 132 (-ss 132 -i input.mp3), and then run the output for 7 seconds (-t 7 output.mp3 or -to 00:00:07 output.mp3).
You can read more about this, as well as details about frame-accurate or not (for re-encoding or not) on the documentation: https://trac.ffmpeg.org/wiki/Seeking
As for -to not being there...
As I shown above, I have the latest version of the software.
You absolutely positively do not remotely have the latest version of FFmpeg. You might have the latest build of whatever branch whatever package manager has, and it may have been built this year, but if you check the download page, the latest release as of this writing is 3.3.4. https://www.ffmpeg.org/download.html
You can either deal with your package manager and dependency hell, or depending on your licensing restrictions, snag a recent static build: https://www.johnvansickle.com/ffmpeg/
Finally, consider -acodec copy to ensure you're not hurting the quality of your audio further by transcoding, since you're keeping the same format.
This works for me
ffmpeg -ss 60 -i input-audio.aac -t 15 -c copy output.aac
-ss 60 means, "start from second 60"
-t 15 audio output length in seconds.. in this case, 15 seconds..
ffmpeg -i "original.mp3" -ss 60 -to 70 "new.mp3"
This works for me.
-ss is an input option, while -t and -to are output options. So you need to do this:
ffmpeg -ss 60 -i 'les nuits 128k.m4a' -to 70 -c copy out.m4a
To Trim Audio file using FFmpeg
startDuration = 00:00:00,
endDuration = 00:00:10
audioPath = audio.mp3,
mp3Output = outputFile.mp3
cmd = "-ss $startDuration -i $audioPath -c copy -t $endDuration $mp3Output"
for Mac:
brew install ffmpeg
ffmpeg -ss start_second -to end_second -i input.mp3 output.mp3
I want to capture the RTSP stream from some IP cameras, and after looking around I found 2 great tools to do this: avconv and openRTSP
openRTSP -u user password rtsp://10.48.34.125/axis-media/media.amp
avconv -i "rtsp://user:password#10.48.34.125/axis-media/media.amp" -vcodec copy -f mp4 10.48.34.125.mp4
but for some voodoo reason when I need to use URLs without an specific extension, such as:
rtsp://user:password#10.48.34.46/
avconv returns 401 Unauthorized
so I'm stuck with openRTSP at the moment...
The thing is, unlike avconv, openRTSP outputs a raw file which is encoded to 25fps, which made some of my videos look like they where in fast-forward. I found a (cpu expensive) way to re-encode the file to a closer frame rate to what I need:
avconv -r 7 -i video-H264-1 -r 24 -f mp4 10.48.34.28.mp4
(in this example I'm forcing the frame rate of the raw file to be 7, and the frame rate of the output file to be 24. I tried using openRTSP build-in flags, but the output file still had a frame rate of 25: openRTSP -f 7 -u user password rtsp://10.48.34.145/mpeg4/media.3gp)
Sadly the video looks odd at certain points, and that's because the original stream sometimes has a variable frame rate (for example at night).
My question is, is there some way to deactive this default encondig to 25fps?
And why 25? I mean, isn't the norm 24?
try:
avconv -rtsp_transport tcp -i rtsp://server -an -vcodec copy -f mp4 10.48.34.28.mp4
if you want to change original video rate to 24 you must transcode it:
avconv -rtsp_transport tcp -i rtsp://server -an -vcodec libx264 -r 24 -f mp4 10.48.34.28.mp4
I have a file, sound.au, which file describes as Sun/NeXT audo data: 8-bit ISDN mu-law, mono, 8000 Hz. I'd like to convert this to a WAV that file would describe as RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz. However, I cannot get the right set of arguments to make this conversion and see what it sounds like.
Has anyone performed this conversion or similar before? sox -t auto -w -s -r 8000 -c sound.au sound.wav gets me close, but it's G711 mu-law, not 16 bit PCM.
Thanks.
I don't have an .au file to try, but I suspect sox sound.au -e signed-integer sound.wav would work. You are only trying to change the encoding from u-law to PCM, right? sox should pick up all the necessary input info from the .au header. If it doesn't, maybe you need sox -t auto sound.au -e signed-integer sound.wav.