Big file conversion .ogv to .avi ogv2avi on Ubuntu - audio

I'm trying to convert a 200MB .ogv file to .avi with a script I found online:
#!/bin/bash
# ogv to avi
# Call this with multiple arguments
# for example : ls *.{ogv,OGV} | xargs ogv2avi
N=$#;
echo "Converting $N files !"
for ((i=0; i<=(N-1); i++))
do
echo "converting" $1
filename=${1%.*}
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o $filename.avi
shift 1
done
After this all I have to do is $ ogv2avi name_of_file.ogv
and it creates the converted.avi file.
It works great for small file, but it seems to crash for big files, and I only get around the first 3 minutes of the 30 minute recording.
Too many audio packets in the buffer: (4096 in 850860 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:10142.
Setting audio delay to 0.078s.
Video stream: 784.308 kbit/s (98038 B/s) size: 21254748 bytes 216.800 secs 3000 frames
Audio stream: 87.341 kbit/s (10917 B/s) size: 2372536 bytes 217.313 secs

I had the exact same problem, and the only way i got around it (a sloppy solution but it works) is to play the .ogv video on the Ubuntu Desktop and record the square were the video is located with a desktop recorder that don't produces .ogv files(I recommend Kazam which produces .webm files). Then use Audacity to edit the audio of the output video if necessary and mix the edited audio with the output video using MkvMerge.

Related

Trim off N bytes from audio file using SoX / FFmpeg etc, on Windows?

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

Piping LAME and SOX togteher in a shell script. Is it possible?

I'm using the following in a shell script :
##For ease of understanding I'll declare the $1 variable here even though it's actually arriving remotely via an ssh2_exec command.
$1="my.mp3"
lame --decode /root/incoming/shows/$1 - | /root/incoming/stereo_tool_cmd_64 - - -s /usr/incoming/settings/setting.sts | lame -b 128 - /root/incoming/processing/$1;
So what is happening? LAME decodes the mp3 file to wav, then it is piped to STEREO TOOL (audio processing script), then back to LAME where it's re-encoded as an mp3 file and the result is written to a different directory.
This all works great but I want to use SOX during this pipe to remove all silence from the start and end of the file, while it's in it's decoded wav state, before hitting STEREO TOOL.
I've tried this but it doesn't work (SOX breaks the pipe) :
lame --decode /root/incoming/shows/$1 - | sox silence 1 0.1 0.1% reverse silence 1 0.1 0.1% reverse | /root/incoming/stereo_tool_cmd_64 - - -s /usr/incoming/settings/setting.sts | lame -b 128 - /root/incoming/processing/$1;
I know the standard way to use SOX would be :
sox input.wav output.wav silence 1 0.1 0.1% reverse silence 1 0.1 0.1% reverse;
But I can't declare the wav file here as it's being created on the fly by LAME.
Is what I'm trying to do impossible or is there a solution that will allow me to do this?

FFMpeg - Segment audio to chunks

I have tried this example in order to segment a given video file using ffmpeg into an m3u8 file and smaller chunks (.ts files). This actually worked great. Is it possible to do practically the same thing with audio input?
This was my most promising approach so far (capturing live audio on Windows OS):
ffmpeg -f dshow -i audio="<name of input device>" -acodec libmp3lame -ab 64000 | segmenter - 10 stream stream.m3u8 http://<IP_OF_SERVER>/stream/stream/ 5 1
But this returns this error:
At least one output file must be specified.
Could not open input file, make sure it is an mpegts file: -1
I really would not know how to convert the live audio stream to an mpegts file.
Could anyone please give me a hint?
Thanks a lot

Changing bitrate of mp3 in ffmpeg - file doesnt run

I am writing a small mp3 conversion tool. We upload a mp3 file & would like to convert it to a 96kbps file & a 320 kbps file. I have written the conversion script & it runs. But these files do not play.
Am i missing something?
the code i've written is:
/usr/local/bin/ffmpeg -i test.mp3 -vn -ar 441000 -ac 2 -ab 96k -f mp2 music/96/test.mp3 2>&1
Thanks!
There are two major issues here:
The audio rate you're setting (-ar 441000) is incorrect. You want 44.1 kHz (-ar 44100).
You're forcing the use of MPEG2 audio (-f mp2), which is not what you want, and is probably not supported by the player you're using either. Leave that option out entirely; the .mp3 extension on the output file will be used as a hint anyway.

Sox conversion from .au to .wav

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.

Resources