I am using Vorbis/ogg to record audio (using arecord
and then pipping to oggenc). I have downloaded oggvideotools, which gave me oggCat
, which will let me join two previously recorded audio files into one file. But, my problem is this:
The device I am working on is known to have the "plug pulled", but it is recording while the power is on (swapping out batteries etc.). Once the device is powered back on, I need to continue to record to the previous file (automated recording).
Right now, I can use arecord
to record two separate files, and then once the recording is done, I can oggCat the two, but that doesn't get me what I want 100%, I need to be able to continue recording where the first file got cut off.
I need python and busybox solutions. Unfortunately, other solutions outside Python and Busybox are not available to me – furthermore, downloading additional packages/programs is also not available, I have oggenc
, arecord
, and oggvideotools
.
Any advise on where to look? Can I somehow pipe arecord
data from a temp file to oggCat
? Like:
oggCat NewFile.ogg File1.ogg (arecord file2.ogg ...)
Where (arecord file2.ogg ...)
is the file currently being recorded and simultaneously being appended to Newfile.ogg
?
PS. The audio files will have the exact same parameters – i.e. same channels, rates, etc.
Best Answer
I haven't tested it but consider using process substitution. This will take the standard output of one program and provide it to another program via a pipe.
If I am correct this would append the new recording to audio.ogg. The biggest problem I see is that arecord appears outputs to output a wav by default so you may need to encode it as an ogg.
Sorry, I don't have a mic to test it out. But I answered anyway because I felt that this is the bit you were looking for and can figure the rest out yourself.