Opus audio disappearing

I’m having an issue with a custom profile set to re-encode movie trailers into h265 mkvs. For some reason, if the original file is an mp4 with Opus audio, the audio disappears. It’s beyond me…I’ve tried switching between handbrake and ffmpeg with no difference.

If I just go out to a command line and build the command line for ffmpeg, it seems to work fine with Opus copied through. I’m mystified as to what’s happening, so I’m sure I just need another pair of eyes to see a dumb typo or something.

The custom profile:

[HEVC MKV Trailers]
Description=HEVC CRF 26 in MKV (H.265/AC3) conversion.
order=ffmpeg,handbrake
ffmpeg-general=-threads 0
ffmpeg-video=-ss 0 -max_muxing_queue_size 4000 -vf yadif=0:-1:1,hqdn3d -vcodec libx265 -preset medium -crf 26 -map 0:v -sn
ffmpeg-audio=-acodec copy -map 0:a
ffmpeg-ext=.mkv
ffmpeg-audiodelay=skip
handbrake-general=–decomb --loose-anamorphic --verbose=2
handbrake-video=–start-at duration:0 -e x265 --encoder-preset medium -q 26
handbrake-audio=-E copy -a 1,2,3,4,5
handbrake-ext=.mkv
handbrake-audiodelay=skip
PreConversionCommercialRemover=false

When I build the command line using these parameters, it looks like this:

ffmpeg -threads 0 -i “Aquaman (2018)-trailer.mp4” -ss 0 -max_muxing_queue_size 4000 -vf yadif=0:-1:1,hqdn3d -vcodec libx265 -preset medium -crf 26 -map 0:v -sn -acodec copy -map 0:a “Aquaman (2018)-trailer.mkv”

If I use that command line, the file keeps the audio…am I dumb and have missed something easy?

That is strange. The audio parameters for ffmpeg and handbrake are to copy. Unless something is happening during the initial remuxing process might be causing the issue.
I’ve never worked with opus audio so I don’t have any specific things to check.

Can you attach the log file for a conversion that didn’t work. We might be able to give you some suggestions on troubleshooting.


Looks like mediainfo on the processed video shows no auto stream at all.
Aquaman (2018)-trailer.mp4-Trailers-2021-01-05T12-01-56.log (744.1 KB)

I took a look at the log. It is seeing the audio track all the way up to running the conversion in handbrake. It just seems to fall off there. Not sure why, but it thinks there is no track.

2021-01-05T12:02:46 MCEBuddy.Transcode.ConvertWithHandbrake → Audio Track : 0
2021-01-05T12:02:50 MCEBuddy.AppWrapper.Handbrake → Warning: Could not find audio track 1, skipped
2021-01-05T12:02:50 MCEBuddy.AppWrapper.Handbrake → Warning: Could not find audio track 2, skipped
2021-01-05T12:02:50 MCEBuddy.AppWrapper.Handbrake → Warning: Could not find audio track 3, skipped
2021-01-05T12:02:50 MCEBuddy.AppWrapper.Handbrake → Warning: Could not find audio track 4, skipped
2021-01-05T12:02:50 MCEBuddy.AppWrapper.Handbrake → Warning: Could not find audio track 5, skipped
2021-01-05T12:02:50 MCEBuddy.AppWrapper.Handbrake → Dropping excess audio encoders

Do you have a log where ffmpeg did the conversion? I’m interested to see how it processed.

after using ffmpeg it looks like there’s an audio stream…but there’s no sound still

Aquaman (2018)-trailer.mp4-Trailers-2021-01-05T14-38-13.log (475.9 KB)

I’m not experienced at all with command line video transcoding, but this seems like a weird problem…surely I’ve typoed something somewhere?

Can you attach a MediaInfo of the original file?

Here’s mediainfo JSON for the audio for the original file and the converted one.

Original file
{
@type”: “Audio”,
“StreamOrder”: “1”,
“ID”: “2”,
“Format”: “Opus”,
“CodecID”: “Opus”,
“Duration”: “145.161”,
“Duration_FirstFrame”: “0.001”,
“BitRate_Mode”: “VBR”,
“BitRate”: “120335”,
“FrameCount”: “7258”,
“Compression_Mode”: “Lossy”,
“StreamSize”: “2183488”,
“StreamSize_Proportion”: “0.04322”,
“Language”: “en”,
“Default”: “Yes”,
“AlternateGroup”: “1”
}

Converted with ffmpeg
{
@type”: “Audio”,
“StreamOrder”: “1”,
“ID”: “2”,
“UniqueID”: “2”,
“Format”: “Opus”,
“CodecID”: “A_OPUS”,
“Duration”: “145.161000000”,
“Channels”: “2”,
“ChannelPositions”: “Front: L R”,
“ChannelLayout”: “L R”,
“SamplingRate”: “48000”,
“SamplingCount”: “6967728”,
“BitDepth”: “32”,
“Compression_Mode”: “Lossy”,
“Delay”: “0.000”,
“Delay_Source”: “Container”,
“Language”: “en”,
“Default”: “Yes”,
“Forced”: “No”
}

So strange, I don’t get it.
There are multiple steps during the conversion. It will remux the original to the temp folder using the following command in your case:

ffmpeg.exe -hide_banner -probesize 100M -analyzeduration 300M -y -i “F:\Test\Aquaman (2018)-trailer.mp4” -ss 0 -vcodec copy -acodec copy -map 0:a -map 0:0 -f mpegts “f:\temp\working0\Aquaman (2018)-trailer.ts”

Then it does other stuff and starts to produce the final file using this command in your case:

ffmpeg.exe -hide_banner -probesize 100M -analyzeduration 300M -threads 0 -y -i “f:\temp\working0\Aquaman (2018)-trailer.ts” -ss 0 -max_muxing_queue_size 4000 -vf hqdn3d -vcodec libx265 -preset medium -crf 26 -map 0:1 -sn -acodec copy -map 0:a “f:\temp\working0\Aquaman (2018)-trailer-converted.mkv”

Run that first command and see if the audio is good or not. If not then we need to figure out why. If it is good, run the second command and see out the f:\temp\working0\Aquaman (2018)-trailer-converted.mkv file turned out.

first command runs, generates ts file with audio ok. Here’s the json from that file.
{
@type”: “Audio”,
“StreamOrder”: “0-0”,
“ID”: “256”,
“MenuID”: “1”,
“Format”: “Opus”,
“CodecID”: “6”,
“Compression_Mode”: “Lossy”,
“Language”: “en”,
“extra”: {
“descriptor_tag_extension”: “128”,
“format_identifier”: “Opus”
}

Audio gone after running the second command. JSON from mediainfo:
{
@type”: “Audio”,
“StreamOrder”: “1”,
“ID”: “2”,
“UniqueID”: “2”,
“Format”: “Opus”,
“CodecID”: “A_OPUS”,
“Duration”: “145.161000000”,
“Channels”: “2”,
“ChannelPositions”: “Front: L R”,
“ChannelLayout”: “L R”,
“SamplingRate”: “48000”,
“SamplingCount”: “6967728”,
“BitDepth”: “32”,
“Compression_Mode”: “Lossy”,
“Delay”: “0.000”,
“Delay_Source”: “Container”,
“Language”: “en”,
“Default”: “Yes”,
“Forced”: “No”
}

Just in case it’s needed, here’s the output when I run the second command:

[spoiler-box]C:\Program Files\MCEBuddy2x\ffmpeg>ffmpeg.exe -hide_banner -probesize 100M -analyzeduration 300M -threads 0 -y -i “f:\temp\working0\Aquaman (2018)-trailer.ts” -ss 0 -max_muxing_queue_size 4000 -vf hqdn3d -vcodec libx265 -preset medium -crf 26 -map 0:1 -sn -acodec copy -map 0:a “f:\temp\working0\Aquaman (2018)-trailer-converted.mkv”
[h264 @ 0000024da0e1e440] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000024da0e1e440] decode_slice_header error
[h264 @ 0000024da0e1e440] no frame!
[h264 @ 0000024da0e1e440] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000024da0e1e440] decode_slice_header error
[h264 @ 0000024da0e1e440] no frame!
[h264 @ 0000024da0e1e440] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000024da0e1e440] decode_slice_header error
[h264 @ 0000024da0e1e440] no frame!
[h264 @ 0000024da0e1e440] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000024da0e1e440] decode_slice_header error
[h264 @ 0000024da0e1e440] no frame!
Input #0, mpegts, from ‘f:\temp\working0\Aquaman (2018)-trailer.ts’:
Duration: 00:02:25.14, start: 1.400000, bitrate: 2846 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:00x100: Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp
Stream #0:1[0x101]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Stream mapping:
Stream #0:1 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.1+19-c4b098f973e6
x265 [info]: build info [Windows][GCC 9.1.1][64 bit] 8bit+10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool 0 using 12 threads on numa nodes 0
x265 [info]: Thread pool 1 using 12 threads on numa nodes 1
x265 [info]: Slices : 1
x265 [info]: frame threads / pool features : 4 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 23 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : CRF-26.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=6 deblock sao
Output #0, matroska, to ‘f:\temp\working0\Aquaman (2018)-trailer-converted.mkv’:
Metadata:
encoder : Lavf58.33.100
Stream #0:0: Video: hevc (libx265), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 1k tbn, 23.98 tbc
Metadata:
encoder : Lavc58.59.100 libx265
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(eng): Audio: opus ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, stereo, fltp
frame= 3383 fps= 11 q=-0.0 Lsize= 31888kB time=00:02:25.14 bitrate=1799.8kbits/s speed=0.465x
video:29677kB audio:2132kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.248575%
x265 [info]: frame I: 108, Avg QP:25.25 kb/s: 6129.21
x265 [info]: frame P: 1068, Avg QP:27.95 kb/s: 2977.66
x265 [info]: frame B: 2207, Avg QP:31.77 kb/s: 899.07
x265 [info]: Weighted P-Frames: Y:11.0% UV:8.8%
x265 [info]: consecutive B-frames: 28.3% 13.0% 12.1% 35.9% 10.7%

encoded 3383 frames in 312.11s (10.84 fps), 1722.24 kb/s, Avg QP:30.36[/spoiler-box]