Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: Blues on October 17, 2018, 11:20:16 AM

Title: Opus track invisible in MKV
Post by: Blues on October 17, 2018, 11:20:16 AM
matroska_reader: The CodecID for track 1 is 'A_OPUS', but the private codec data does not contain valid headers.

This is what I get from mkvtoolnix when I try to open a file encoded by Avidemux.
Title: Re: Opus track invisible in MKV
Post by: eumagga0x2a on October 17, 2018, 11:53:45 AM
WFM with Avidemux from the current git master and mkvtoolnix 25.0.0. Please specify steps to reproduce.
Title: Re: Opus track invisible in MKV
Post by: Blues on October 17, 2018, 03:43:47 PM
Loaded file to Avidemux (git a few days ago), video to copy, audio to Opus bitrate 96, container MKV. Resulting file plays in MPV, but when loaded to mkvtoolnix-23.0 GUI [to add subtitles] there is no audio track. Getting the mentioned error instead. You think the mkvtoolnix is too old?
Title: Re: Opus track invisible in MKV
Post by: eumagga0x2a on October 17, 2018, 04:07:58 PM
Well, I tested with bitrate set to 128 kbit/s, but I doubt this would matter.

QuoteYou think the mkvtoolnix is too old?

It may depend on the opus version on your system as well. I use v1.3.

Actually, mkvtoolnix has such a high pace of development that trying a build from the git head looks reasonable.
Title: Re: Opus track invisible in MKV
Post by: Blues on October 18, 2018, 03:39:07 AM
OK, thanks. At least I know now where to look.
Title: Re: Opus track invisible in MKV
Post by: Blues on December 17, 2018, 11:47:16 PM
OK, something is wrong. I have a file here, from youtube, mkv, opus audio. When I use Avidemux to extract audio I get a file which does not identify as opus. When I use mkvextract it gives me opus file.
File itself is here: http://www.asclinux.com/tmp/hmsn.mkv
Title: Re: Opus track invisible in MKV
Post by: eumagga0x2a on December 20, 2018, 02:42:12 PM
Avidemux saves only raw audio data, no Ogg container structures and no codec extradata, unfortunately, which renders the feature in case of Opus audio useless.
Title: Re: Opus track invisible in MKV
Post by: Blues on December 21, 2018, 11:28:13 PM
Right, so this is also the reason for problem in the first post.
Title: Re: Opus track invisible in MKV
Post by: eumagga0x2a on December 21, 2018, 11:44:34 PM
I don't think so. Avidemux correctly handles Opus extradata when muxing, just not when dumping a raw stream.
Title: Re: Opus track invisible in MKV
Post by: Blues on November 25, 2019, 05:53:34 PM
I'm still having issue with opus. Avidemux-2.7.4, mkvtoolnix-37. Using Avidemux to encode audio in opus and muxing into mkv. When trying to add subtitles with mkvtoolnix the resulting file has no audio. Tried to extract audio from this mkv, got this error:
Error: Track 1 with the CodecID 'A_OPUS' is missing the "codec private" element and cannot be extracted.
Made further attempt to get the audio out of Avidemux created mkv so I could remux it with added subtitles. With ffmeg:
[opus @ 0x55d2160dec80] No extradata present
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Stream mapping:
  Stream #0:1 -> #0:0 (copy)

Then VLC, set video and audio into copy mode, the output mkv has no audio. Tried to play this file with VLC, silence. The only application which can find the audio is MPV so far.

How can I add subtitles to this file? I do not want to recode the audio.

OK. I managed to redo all cutting and editing in original file and create a matching audio file for my video. Then I encoded it using opusenc and all is fine now. Just have to remember not to use opus encoding in Avidemux. :(
Title: Re: Opus track invisible in MKV
Post by: eumagga0x2a on November 25, 2019, 09:13:14 PM
I'll look into creating Opus extradata. On Linux, all video players play mkv files with Opus audio as generated by Avidemux just fine (indeed, mkvtoolnix doesn't like that extradata are missing and drops the audio track). FFmpeg won't add extradata on its own, which are required for saving audio as a file, but apart from that, happily remuxes extradata-less mkv.
Title: Re: Opus track invisible in MKV
Post by: eumagga0x2a on November 26, 2019, 12:45:27 AM
mkvtoolnix should be happy now (https://github.com/mean00/avidemux2/commit/6351c73004b5a26c76b9b2846929c042af47f7e3). Please be aware that this doesn't enable Avidemux or mkvtoolnix to dump the audio stream to a playable audio file.
Title: Re: Opus track invisible in MKV
Post by: Blues on November 26, 2019, 02:06:00 PM
Thanks!