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

Moritz Barsnick barsnick at gmx.net
Mon Nov 30 01:18:08 CET 2015


Hi Peter,

On Mon, Nov 30, 2015 at 00:09:41 +0100, Peter B. wrote:
> - In some players (e.g. VLC) audio plays fine at the beginning, but is
> mute when the actual program starts.

Indeed. At the same time, mplayer and ffplay play it fine.

> - It "seems" that the audio samplerate changes mid-stream between 48kHz
> and 44.1kHz.

vlc says:
[00007f84acefb7b8] packetizer_mpeg4audio packetizer: AAC channels: 1 samplerate: 24000

> - Remuxing to MKV fails with the error message:
>    "Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument"
>     (Commandline and complete, uncut console output below: (1))

Actually, the issue is
> [matroska @ 0x3844e60] Error parsing AAC extradata, unable to determine samplerate.

I don't know why this causes an issue. I believe a change was
introduced to ffmpeg to avoid creating "illegal" Matroska files.

On the other hand, I can remux your file to MP4 and that to Matroska,
and that works fine, i.e. ffmpeg doesn't complain. VLC still won't play
the sound though.

> - Re-encoding audio to "pcm_s16le" fails:
>     [quote]
>         [aac @ 0x2258720] channel element 2.0 is not allocated
>         Error while decoding stream #0:1: Invalid data found when processing input
>         [aac @ 0x2258720] element type mismatch 1 != 0
>     [/quote]

It doesn't actually "fail". Did you even have a look at the output
file? I (and so do you) get a complete file, which includes 30 seconds
of video and audio, and VLC plays the sound just fine now. Same if I
recode audio to something else such as AAC (using libfdk_aac). So I
believe ffmpeg's audio decoder handles your file fine, while VLC has
some issues.

> How could this MPEG-TS file be normalized in a way that the video is
> kept as-is, but the audio is e.g. resampled to a common rate, in order
> to play fine on all players?

I think you were on the right track, and failed to see that the second
file actually works. ;-)

Moritz


More information about the ffmpeg-user mailing list