Log in

View Full Version : FFMpeg error while muxing a hls-videostream to matroska.


Reino
26th February 2015, 00:30
ffmpeg.exe -hide_banner -i npo-hls.m3u8 -c copy -bsf:a aac_adtstoasc "npo-hls.mp4"
Input #0, hls,applehttp, from 'http://xxx.npostreaming.nl/npo-hls.m3u8':
Duration: 00:21:09.00, start: 1.000000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 156 kb/s
Stream #0:1: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p,
608x342 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Output #0, mp4, to 'npo-hls.mp4':
Metadata:
encoder : Lavf56.21.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 608x342 [SAR 1:1 DAR 16:9],
q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 156 kb/s
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)No problem at all. But...

ffmpeg.exe -hide_banner -i npo-hls.m3u8 -c copy "npo-hls.mkv"
Input #0, hls,applehttp, from 'http://xxx.npostreaming.nl/npo-hls.m3u8':
Duration: 00:21:09.00, start: 1.000000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 156 kb/s
Stream #0:1: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p,
608x342 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
[matroska @ 03d81020] Error parsing AAC extradata, unable to determine samplerate.
Output #0, mp4, to 'npo-hls.mkv':
Metadata:
encoder : Lavf56.21.100
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 608x342 [SAR 1:1 DAR 16:9],
q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc
Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, 156 kb/s
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Muxing to matroska fails. Is this a known issue? Does anyone know if this can be fixed?

(ffmpeg version used: 20150215-git-2a72b16, video-link: youtube-dl.exe -gf m3u8-1196 http://www.npo.nl/nos-journaal/14-02-2015/POW_00942207 (http://l24m70a45ee82b0054ee4ea3000000.5767ee706615c92d.adaptive-e50c1b.npostreaming.nl/lmshieldv2/3/nos/rest/2015/POW_00942207/POW_00942207.ism/POW_00942207-audio_eng%3D128000-video%3D1001000.m3u8))

xooyoozoo
26th February 2015, 01:03
I'm not sure, but you have different command lines for each, so maybe that's why?

ADTS doesn't signal SBR (which changes the samplerate), so a muxer cannot be sure of AAC's samplerate without doing lower-level decoding. I guess this is where a bitstream filter becomes useful, like in your .mp4 command.

nevcairiel
26th February 2015, 01:04
ADTS AAC (as in a TS stream) cannot be muxed into MKV officially, although some tools have historically allowed it (and even ffmpeg at one time), you should use the same bitstream filter you used for the MP4 case as well.

Reino
26th February 2015, 01:37
It doesn't matter whether I use -bsf:a aac_adtstoasc for muxing to matroska or not. The same error shows up.

Reino
26th February 2015, 20:10
So if you want to mux to mkv, at the moment there's no other option than to mux to and create a temporary mp4-file?

Reino
25th December 2016, 20:58
I knew FFMpeg had already fixed this issue, but finding this old thread now, I thought I'd mention to conclude this thread:

ffmpeg.exe -hide_banner -i "npo-hls.m3u8" -c copy "npo-hls.mkv"
Input #0, hls,applehttp, from 'http://xxx.npostreaming.nl/npo-hls.m3u8':
Duration: 00:24:59.00, start: 10.000000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
Metadata:
variant_bitrate : 0
Stream #0:1: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p,
1024x576 [SAR 1:1 DAR 16:9], 25 tbr, 90k tbn, 50 tbc
Metadata:
variant_bitrate : 0
Output #0, matroska, to '..\npo-hls.mkv':
Metadata:
encoder : Lavf57.58.101
Stream #0:0: Video: h264 (Constrained Baseline) (H264 / 0x34363248), yuv420p,
1024x576 [SAR 1:1 DAR 16:9], q=2-31, 25 tbr, 1k tbn, 90k tbc
Metadata:
variant_bitrate : 0
Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp
Metadata:
variant_bitrate : 0
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (copy)