FFMPEG transcode/downmix audio stream > 2 audio output streams fails

IMPORTANT REQUIRED: ZIP/ATTACH CONVERSION LOGS for Bugs Reports (see below)


Request Type:
BUG
MCEBuddy Version and Type (32bit or 64bit):
2.4.7 x64
Operating System and Type (32bit or 64but):
Windows 10 x64
Summary of the problem or suggestion:
I have a number of MKV files with a single DTS audio stream. I am using the H264_NVENC encoder and thus must utilize ffmpeg for this function - namely to transcode/downmix the single DTS 5.1 source audio stream to both an AAC2.0 and AC35.1 output audio streams.
I have configured the profiles.conf with the appropriate ffmpeg audio config to provide for this function:
ffmpeg-audio=-filter_complex "[0:a]asplit[2ch][6ch];[2ch]pan=stereo|FL=FC+0.6FL+0.2BL|FR=FC+0.6FR+0.2BR[aac]" -map [aac] -map [6ch] -c:a:0 libfdk_aac -cutoff 18000 -metadata:s:a:0 title="Stereo" -disposition:a:0 default -c:a:1 ac3 -metadata:s:a:1 title="Surround" -disposition:a:1 none

The debug log provides the following details re: conversion failure:
[AVFilterGraph @ 0000028a2c3d62e0] Unable to parse graph description substring: “Â -map”

The complex filter values must be contained in quotation marks which seems to be the cause for conversion failure.

Steps to replicate the bug:
Configure conversion task to convert (via ffmpeg) a source .MKV file with a single (non-AC3) 5.1 audio source to MP4, transcoding/downmixing to two (2) output audio streams. Example profiles.conf task settings (please refer to the “ffmpeg-audio=” section):

[TV MP4 Video HQ NVENC]
Description=High profile, good quality 1 pass MP4 (H.264/Audio) NVENV (Constant Quality) conversion.
order=ffmpeg
ffmpeg-general=-threads 0
ffmpeg-video=-vcodec nvenc_h264 -profile:v main -level:v 4.0 -preset hq -rc vbr -qmin 10 -qmax 51 -refs 4 -bf 4 -g 300 -b:v 2500k -maxrate 3000k -bufsize 6000k -map 0:v -sws_flags lanczos -map_chapters -1 -map_metadata -1 -movflags +faststart -metadata:s:v title="" -sn
ffmpeg-audio=-filter_complex "[0:a]asplit[2ch][6ch];[2ch]pan=stereo|FL=FC+0.6FL+0.2BL|FR=FC+0.6FR+0.2BR[aac]" -map [aac] -map [6ch] -c:a:0 libfdk_aac -cutoff 18000 -metadata:s:a:0 title="Stereo" -disposition:a:0 default -c:a:1 ac3 -metadata:s:a:1 title="Surround" -disposition:a:1 none
ffmpeg-audioac3=-map 0:a -c:a:1 copy -metadata:s:a:1 title="Surround" -disposition:a:1 none -map 0:a -c:a:0 libfdk_aac -ab 128k -ar 48000 -ac 2 -cutoff 18000 -metadata:s:a:0 title="Stereo" -disposition:a:0 default
ffmpeg-ext=.mp4
ffmpeg-audiodelay=skip
PreConversionCommercialRemover=true

I have attached the conversion debug log and the mediainfo output of an example source MKV file showing the single DTS audio stream (Salvation - S01E02 - Another Trip around the Sun.mkv.txt)

Screenshots:
Salvation - S01E02 - Another Trip around the Sun.mkv-TV MP4 VBR Clip-2017-07-23T17-50-20.0727306-07-00.log.zip (677.7 KB)
Salvation - S01E02 - Another Trip around the Sun.mkv.txt (6.1 KB)

Took your profile and replicated it, no such problem here, it’s running fine:

2017-07-24T16:20:13 MCEBuddy.AppWrapper.FFmpeg → Stream #0:0 → #0:0 (h264 (native) → h264 (nvenc_h264))
2017-07-24T16:20:13 MCEBuddy.AppWrapper.FFmpeg → Stream #0:1 → #0:1 (ac3 (native) → aac (libfdk_aac))
2017-07-24T16:20:13 MCEBuddy.AppWrapper.FFmpeg → Stream #0:1 → #0:2 (copy)

I think your issue is that your file editor isn’t saving the profiles.conf in right character encoding (UTF-8) or that it’s converting some of your characters into unicode extended characters while saving it.

Essentially you’ve got a file editor problem.

I have verified my profiles.conf file is UTF-8.

With your test, were you utilizing a source file with a single non-AC3, 6 channel audio stream (e.g. DTS, DTS-HD, etc.)? The log output you’ve provided suggests your source had an AC3 audio stream. That being the case, your test referenced the profile’s “ffmpeg-audioac3=” settings rather than the “ffmpeg-audio=” settings which is where the problem lies for me currently.

For reference, running ffmpeg via CLI generates the following stream mappings, correctly utilizing the filters specified in profiles.conf (i.e. ffmpeg-audio=-filter_complex “[0:a]asplit[2ch][6ch];[2ch]pan=stereo|FL=FC+0.6FL+0.2BL|FR=FC+0.6FR+0.2BR[aac]” -map [aac] -map [6ch] -c:a:0 libfdk_aac -cutoff 18000 -metadata:s:a:0 title=“Stereo” -disposition:a:0 default -c:a:1 ac3 -metadata:s:a:1 title=“Surround” -disposition:a:1 none)

Stream #0:1 (dca) -> asplit (graph 0)
Stream #0:0 -> #0:0 (h264 (native) -> h264 (nvenc_h264))
pan (graph 0) -> Stream #0:1 (libfdk_aac)
asplit:output1 (graph 0) -> Stream #0:2 (ac3)

Right since you have a very specific advanced profile, I’m guessing you may not want MCEBuddy to mess with your settings. I would recommend exploring the use of these 3 options in your profile

ffmpeg-VideoOptimized=true
ffmpeg-AudioOptimized=true
ffmpeg-UsingHardwareEncoding=true

See the documentation on how they work

Okay I tried using a AAC multi channel audio file as a test (one change, moved from nvenc to software encoder), I’m getting a different error which looks like is related to the encoder settings but I still cannot replicate your original error which looks like a unicode error to me. In my test the profiles.conf file was saved as a UTF16LE format.

This is what I get:

2017-07-25T11:18:21 MCEBuddy.AppWrapper.FFmpeg → Stream mapping:
2017-07-25T11:18:21 MCEBuddy.AppWrapper.FFmpeg → Stream #0:0 (aac) → asplit (graph 0)
2017-07-25T11:18:21 MCEBuddy.AppWrapper.FFmpeg → Stream #0:2 → #0:0 (h264 (native) → h264 (libx264))
2017-07-25T11:18:21 MCEBuddy.AppWrapper.FFmpeg → pan (graph 0) → Stream #0:1 (libfdk_aac)
2017-07-25T11:18:21 MCEBuddy.AppWrapper.FFmpeg → asplit:output1 (graph 0) → Stream #0:2 (ac3)
2017-07-25T11:18:21 MCEBuddy.AppWrapper.FFmpeg → Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

EDIT: I used a two track non AC3 audio file, will try again with a single track non AC3 multi channel audio file

You have a non ASCII character in your original command hidden in between somewhere. Clean it up and you error will disappear.

With a single track multi channel audio file, can’t replicate the same error. This error is likely due to a profile issue, in my sample video video was track 1 and audio track 0:

Input:

2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → Stream #0:00x100: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 5.1, fltp, 159 kb/s
2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → Stream #0:1[0x101]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

Output:

2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → Stream mapping:
2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → Stream #0:0 (aac) → asplit (graph 0)
2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → Stream #0:1 → #0:0 (h264 (native) → h264 (libx264))
2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → pan (graph 0) → Stream #0:1 (libfdk_aac)
2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → asplit:output1 (graph 0) → Stream #0:2 (ac3)
2017-07-25T11:33:08 MCEBuddy.AppWrapper.FFmpeg → Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

If you’re still getting the same error as your original post check your file encoding.

As suggested, I have added “ffmpeg-AudioOptimized=true” to my profiles. My conversion tasks which refer to “ffmpeg-audio=”, namely any non-AC3 audio source, are now working.

Further testing this morning reveals that the original problem persists for conversion tasks (AC3 source media streams) which refer to “ffmpeg-audioac3=”

1 Like

You have an extended non ascii character in your command line. Use an online tool like UberToolz : Clean TEXT Data to clean up your non ascii characters and it will work fine.