How do I join AAC/.m4a files via CLI (Mac OS X) - command-line

I need to quickly join a number of separate m4a files in to one large one. Is there any way to do so via CLI on in Mac OS X?

I think I found a way myself without any transcoding nessesary, with some inspiration from Coxys answer. MP4Box lets me do it: MP4Box -cat file1.m4a -cat file2.m4a output.m4a. It doesn´t retain any metadata but for my purpose its just fine.
Now, given Coxys answer, are there any pitfalls with the file I just haven´t discovered yet?

Unfortunately AAC files cannot be joined by simple concatenation, which is what I assume you mean when you mention doing it via the command line?
If you installed something like ffmpeg then you could certainly build up a process to take in AAC audio files, convert them to the uncompressed wave data, join them all up, then export the resulting file back to AAC again.
Alternately, if using the CLI is not a hard requirement then you could do this with iTunes and Audacity.

Related

MP4Box MP4 concatenation not working

I download lectures in mp4 format from Udacity, but they're often broken down into 2-5 minute chunks. I'd like to combine the videos for each lecture into one continuous stream, which I've had success with on Windows using AnyVideo Converter. I'm trying to do the same thing on Ubuntu 15, and most of my web search results suggest MP4Box, whose documentation and all the online examples I can find offer the following syntax:
MP4Box -cat vid1.mp4 -cat vid2.mp4 -cat vid3.mp4 -new combinedfile.mp4
This creates a new file with working audio, but the video doesn't work. When I open with Ubuntu's native video player, I get the error "No valid frames decoded before end of stream." When I open with VLC, I get the error "Codec not supported: VLC could not decode the format 'avc3' (No description for this codec." I've tried using the -keepsys switch, as well, but I get the same results.
All the documentation and online discussion makes it sound as though what I'm trying to do is and should be really simple, but I can't seem to find info relevant to the specific errors I'm getting. What am I missing?
Use the -force-cat option.
For example,
MP4Box -force-cat -add in1.mp4 -cat in2.mp4 -cat in3.mp4 ... -new out.mp4
From the MP4Box documentation:
-force-cat
skips media configuration check when concatenating file.
It looks, by the presence of 'avc3', that these videos are encoded with h.264|avc. There are several modes for the concatenation of such streams. Either the video streams have compatible encoder configurations (frame size, ...) in which case only one configuration description is used in the file (signaled by 'avc1'). If the configurations are not fully compatible, MP4Box uses the 'inband' storage of those configurations (signaled by 'avc3'). The other way would be to use multiple sample description entries (stream configurations) but that is not well supported by players and not yet possible with MP4Box. There is no other way unless you want to reencode your videos. On Ubuntu, you should be able to play 'avc3' streams with the player that goes with MP4Box: MP4Client.

Can we segment more than one movie file using mediafilesegmenter tool - HTTP Live Streaming

Is there any way to achieve segmenting from more than one movie file using mediafilesegmenter. I want to create one prog_index.m3u8 file from multiple movie files.
If mediafilesegmenter doesn't support, can anyone suggest alternate approach to achieve this.
Thanks in advance to all the viewers who takes time to look into this query .
Thanks
Sudheer
I couldn't find any help for segmenting more than one video file using mediafielsegmenter but found a solution to my issue.
As we know that mediafilesegmenter tool will generate a prog_index.m3u8 file by default after segmenting the movie file, here I'm creating a new index file with contents appended from prog_index.m3u8 and updating the new index file when a new movie file is segmented. This has solved my issue.
MediaFileSegmenter is not meant for combining more than one files. It's used for segmenting video files.
If you want to combine multiple files you can use ffmpeg. It's a very simple and efficient tool for performing various operations on video files.
From ffmpeg documentation,
Create a file mylist.txt with all the files you want to have concatenated in the following form:
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output
The -safe 0 above is not required if the paths are relative.
you can find more on concatenation here.
Once you have combined the files. Segment them using mediafilesegmenter, you don't need to manually append index files within prog_index.m3u8.

Sync (Diff) of the remote binary file

Usually both files are availble for running some diff tool but I need to find the differences in 2 binary files when one of them resides in the server and another is in the mobile device. Then only the different parts can be sent to the server and file updated.
There is the bsdiff tool. Debian has a bsdiff package, too, and there are high-level programming language interfaces like python-bsdiff.
I think that a jailbreaked iPhone, Android or similar mobile device can run bsdiff, but maybe you have to compile the software yourself.
But note! If you use the binary diff only to decide which part of the file to update, better use rsync. rsync has a built-in binary diff algorithm.
You're probably using the name generically, because diff expects its arguments to be text files.
If given binary files, it can only say they're different, not what the differences are.
But you need to update only the modified parts of binary files.
This is how the Open Source program called Rsync works, but I'm not aware of any version running on mobile devices.
To find the differences, you must compare. If you cannot compare, you cannot compute the minimal differences.
What kind of changes do you do to the local file?
Inserts?
Deletions?
Updates?
If only updates, ie. the size and location of unchanged data is constant, then a block-type checksum solution might work, where you split the file up into blocks, compute the checksum of each, and compare with a list of previous checksums. Then you only have to send the modified blocks.
Also, if possible, you could store two versions of the file locally, the old and modified.
Sounds like a job for rsync. See also librsync and pyrsync.
Cool thing about the rsync algorithm is that you don't need both files to be accessible on the same machine.

MP3 conversion on Amazon's EC2

I run a small record label and we have a bunch of audio files stored on Amazon's S3. We want them converted to MP3's with a standard bitrate. I read about the NYTimes converting all their PDF's using EC2 and since I'm a nerdy web programmer, I'm intrigued. Instead of downloading all the files and converting them by hand, I'm wondering what it takes to set up an EC2 instance and get it set up to convert files? I want to be able to control it from my web server with PHP, so is the approach to create a virtual LAMP stack and install the LAME encoder?
If you want to convert your audio files (I'm assuming .wav since it's a pretty common format pre-format conversion) to mp3 LAME is a solid encoder.
A full blown LAMP stack is highly unnecessary for using LAME, a simple shell script will suffice.
This will convert all *.wav files in the current directory to .mp3 files if they do not have a converted copy already in-place (LAME doesn't care about clobbering output files).
#!/bin/bash
for file in *.wav; do
dest="${file%wav}mp3"
if [[ -e "$file" ]] && [[ ! -e "$dest" ]]; then
lame "$file" "$dest"
fi
done
You will want to look through man lame for the conversion options specific to your VBR/CBR/ABR (variable, constant and average bitrate) needs.
While the above answer would work if you already had the files in the local EC2, you'll have to fetch each song from S3 into EC2, either into a pipe for conversion or into a temporary file, then either pipe it back up to S3 or store it in a temp file and then send it back to EC2.
Haven't actually used EC2, so not sure what kind of storage you're working with, but you should have plenty of space to store the one temporary mp3.
You would probably also want to create some way of tracking status, probably by doing a listing on your bucket before you start.
Probably a perl script using the S3 module would be more suited, but I'm too lazy to type that all in here :).
You could use Elastic MapReduce for this. Although you'd have to play around a bit to get it to spit out separate files as output.

Best he-aac encoder on linux?

I need an encoder that can convert mp3 files to he-aac (aka aac+).
So far the best one I have found is nero aac encoder .
I have two problemes with it :
- Only one input format : wav . It is a little bit slow to transform mp3 files to wav and then to he-aac.
- a free license for non commercial use.
Too bad ffmpeg does not support he-aac ...
There is a commercial solution, on2 flix, but it seems to be a golden hammer for the simple task I need to do.
Nero AAC is the only one as far as I know. Even if FAAC supported HE-AAC it would be useless, since as an encoder its pretty awfully designed and its quality is not even competitive with LAME, let alone a good AAC encoder.
Kostya on the FFMPEG team is currently working on an AAC encoder but it has a long way to go--its not ready for primetime with LC-AAC, let alone HE-AAC (its not even committed to the repository yet). The first step before anything will be to get the ffmpeg decoder to support HE-AAC; currently it can only be decoded through FAAD.
I don't believe there is any HE-AAC encoder on any platform with a more permissive license than Nero's at this point in time.
I've been using neroAacEnc for quite a while now, and I'm largely satisfied with the results. If you're on Linux, making an .AAC file out of an .MP3 or whatever else, is quite easy, all you need is a small wrapper script, that takes care of decoding into .WAV and after encoding, removes the .WAV file.
Be advised: Converting from one lossy encoding to another further reduces quality. So when you can live with .MP3 and you don't have lossless sources, you better stick to them.
Here's a small script, that converts from .FLACto .AAC, it accepts only .FLAC files as arguments:
#!/bin/zsh
for file in ${argv[*]}; do
flac -d ${file}
neroAacEnc -q 0.6 -if ${file%%.flac}.wav -of ${file%%.flac}.aac
rm ${file%%.flac}.wav
done
This script is sequential, but it can be easily made into a multithreaded script.
There is an encoder called accplus which is under the GNU license available here.
Another encoder: mp4tools
I don't have an idea about the quality, but I just found
enhAacPlusEnc