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

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Dec 3 15:26:40 CET 2015


On Tuesday 01 December 2015 12:28:03 am Peter B. wrote:
> On 11/30/2015 01:52 AM, Carl Eugen Hoyos wrote:
> > On Monday 30 November 2015 12:09:41 am Peter B. wrote:
> >> $ ffmpeg -i esdn_audio_problem-20151128.ts -c:v copy
> >> -c:a pcm_s16le output.ts
> >
> > pcm is not an allowed audio codec for mpeg-ts, this is a limitation
> > of the specification, not FFmpeg. Choose another audio codec. Native
> > aac is transparent for high (and even not-so-high) bitrates.
>
> That is very good to know indeed!
> Would it be possible to put that information somewhere in the error
> message?

"The" error message?

> 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.
Please understand that FFmpeg generally cannot stop you from writing 
invalid media files (and it is of course not even generally clear 
what "invalid" means in this sentence but let's say FFmpeg cannot 
stop you from writing invalid media files for any definition of 
"invalid").

> 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.

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)

Carl Eugen


More information about the ffmpeg-user mailing list