[FFmpeg-user] Remux MPEG-TS file fails: Mid-stream changes?

Peter B. pb at das-werkstatt.com
Sat Dec 12 12:08:46 CET 2015


On 12/03/2015 03:26 PM, Carl Eugen Hoyos wrote:
>> The error it returned seemed more like an invalid input, rather than a
>> non-specification conform output choice:
>> [quote]
>>   [aac @ 0x37a4720] channel element 2.0 is not allocated
>>   Error while decoding stream #0:1: Invalid data found when processing
>> input [aac @ 0x37a4720] element type mismatch 1 != 0
>> [/quote]
> This message is completely unrelated to what I wrote above.

Ah. Okay.


>> btw, choosing to transcode the audio *and* using Matroska did the trick:
>> I've now tried converting the audio to pcm_s16le and using Matroska as
>> output container, and now the audio works for the whole video :D
> I don't think that this is a good idea.
>
> mpegts is a container (maybe the only one) that by definition allows 
> data corruption. So in your source file you have data corruption. (I 
> mean generally, not necessarily in the file that you tested but the 
> error message you quote above can be an indication for such an error.)
> While I haven't read the matroska specification, I am quite sure that it 
> does not allow corruption. So if you do -vcodec copy for ts input and 
> mkv output there is a realistic chance of producing invalid output.

Hm...
According to what you said, it seems that there are multiple things
wrong with these MPEG-TS files?

I was mainly looking for a way to normalize the format/behavior of the
audio track, because it couldn't be opened properly in NLEs or most
players it was opened with.

The error message above only refers to the audio channel, so I assumed
that copying the video stream should be okay.
Furthermore, my personal experience has shown that many errors with
digital video files are caused by unclean embedding of streams in the
container - and often resolved by rewrapping to a new one.

Any suggestions on how to properly deal with such a case are very welcome!



> The main question imo is: Why do you want to remux a file that is 
> already in a well specified format that all media players support 
> out-of-the-box? (Contrary to Matroska)

Actually, those files are *not* playing well on most of the media
players and/or NLEs, because of the way the audio-encoding is changing
mid-stream.
Therefore, the idea was to normalize the audio encoding to uncompressed
PCM - and then remuxing it to MKV, because MPEG-TS can't handle PCM.

Additionally, MKV seems to be getting more and more interesting for
long-term preservation.



Thanks again,
Pb


More information about the ffmpeg-user mailing list