Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Mint KDE on the Desktop, Debian on the Server
Posts: 66
Rep:
ffmpeg - Concatenating mpg + ac3 files into one
Hello,
I'm doing some more experimenting with ffmpeg, this time to merge a number of video files into one, they are mpg with ac3 audio and after looking around a bit I found this way of doing it:
And well, it does concatenate the files and merges it into one, but the audio is lost and I have no idea why..., by using -acodec copy it shouldn't do anything other than a plain transcription of the ac3 bits yet for some reason it doesn't.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I have no idea with video files, but audio mp3 files can be simply concatenated: cat file1 file2 >> file3
Could this be also the case with files containing a/v?
Concatenation works with some media formats and not with others. Usually only those that store the data in individualized packets within the stream can be catted. The .avi container, for example, does not; all its metadata is stored in a single section at the beginning of the file, so catting doesn't work properly.
Most, if not all, of the mpeg standard types are packetized, so in general the above should work. However, it's usually best to repackage the catted stream in a new container in any case, to ensure that all the metadata and timing info are accounted for properly. That's certainly why the above command is being piped through ffmpeg.
But another thing to watch out for is that most media encoders require that the input streams all have the same parameters before they will combine them. It could be that one of the catted streams has something different about it that is breaking the ffmpeg processing.
There may also be cases where ffmpeg considers certain combinations of bitrates and such to be "illegal" for the container used.
** What we really need to see is the actual output text of the commands, particularly for ffmpeg. Vague descriptions about how "it's not working" aren't enough. We need details. **
Also try breaking the command up into individual steps. First cat the files together into a single video, then run that video through ffmpeg separately. This should eliminate the possibility that the pipe itself is causing any trouble.
Edit: One more possibility I just remembered is that AC3 is usually handled by the external faac and faad libraries. One of these may not be installed on your system, or your version of ffmpeg may not have been compiled with support for them enabled (since the format is patent-encumbered). Again, the ffmpeg output should inform us if this is the case.
Last edited by David the H.; 02-27-2011 at 08:39 AM.
Reason: as stated
Distribution: Mint KDE on the Desktop, Debian on the Server
Posts: 66
Original Poster
Rep:
Hey David the H.
First of all thanks for your very thorough response, indeed it was my bad to overlook posting ffmpeg's output, of which I should let you know that I'm using the binaries provided on Marillat's Debian Multimedia repository.
All of the files I am working on are from the same source so encoding and quality should be consistent and I don't think are a problem for the encoding.
Well, that is an odd one. Everything does seem to be working. I'm guessing that libfaac is correctly installed on your system then.
The main possibility I can think of then is that ffmpeg is somehow choking on the audio. It may have something to do with ffmpeg's handling of ac3 decoding.
Try playing the separate source files with ffplay. Then cat them together and try it again. You might try them on a variety of other players as well, such as mplayer and vlc.
Next, try processing (codec copy) each of the individual source files through ffmpeg and test the output files again.
If possible, see if you can find a different video series you can process in the same way to confirm whether it's a problem with ffmpeg or with the video.
If nothing else works, you may have to demux the audio and video streams and combine them individually, then remux them back together. But that could lead to timing problems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.