Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#8035 closed defect (invalid)

Issue with audio channel mapping

Reported by: svihalekjan Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: filter_complex amerge audio channel mapping
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

WHAT I AM TRYING TO DO:

I am encoding an HD mxf video file into other HD mxf video file (different parameters) - the video conversion is ok.
I am also trying to encode the input file (that has 8 audio streams - each 1 channel; 48 kHz, 24b PCM, more info in attached MediaInfo - input_file_mediainfo.txt) so that the output file will have 1 audio stream defined as follows:
1 audio stream:

  • 1st channel = 1st channel of 1st audio stream of input file
  • 2nd channel = 1st channel of 2nd audio stream of input file
  • 3rd-8th channel = empty audio channel

Input file media info can be found in input_file_mediainfo.txt.

The issue happens with ffmpeg-20190327-681957b-win32-static build (and ffmpeg-20190411-3e10223-win64-static),
but does not happen with ffmpeg-4.0-win32-static build (https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.0-win32-static.zip) or https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.0-win64-static.zip.
(32b builds are being used on server; 64b builds used on local PC)

PROBLEM ENCOUNTERED:
The issue is with the fact that output audio sounds has some "dither"-like & noise feel after 1st minute.
With some other files there are blank parts of audio within the channel(s).

EXACT FFMPEG COMMAND:

% ffmpeg -v 9 -loglevel 99 -i "audio_channel_mapping_issue_2_22.mxf" -f lavfi -i anullsrc=r=48000:cl=mono -map 0:v -y -c:v mpeg2video -s 1920x1080 -video_format pal -profile:v 0 -level:v 2 -r 25 -aspect 16:9 -flags +ildct -b:v 50000k -minrate 50000k -maxrate 50000k -filter_complex "[0:a:0][0:a:1][1:a:0][1:a:0][1:a:0][1:a:0][1:a:0][1:a:0]amerge=inputs=8[a]" -acodec pcm_s24le -map "[a]" "OUTPUT.mxf"

FULL CONSOLE OUTPUT (+OUTPUT FILE MEDIAINFO):
new build (where the issue appears):
ffmpeg-20190704-140832.log & newer_build_output_mediainfo.txt
older build (without any issues):
ffmpeg-20190704-145519.log & older_build_output_mediainfo.txt

Attachments (5)

older_build_output_mediainfo.txt (3.9 KB ) - added by svihalekjan 5 years ago.
newer_build_output_mediainfo.txt (3.9 KB ) - added by svihalekjan 5 years ago.
ffmpeg-20190704-145519.log (43.2 KB ) - added by svihalekjan 5 years ago.
ffmpeg-20190704-140832.log (42.1 KB ) - added by svihalekjan 5 years ago.
input_file_mediainfo.txt (9.5 KB ) - added by svihalekjan 5 years ago.

Download all attachments as: .zip

Change History (15)

by svihalekjan, 5 years ago

by svihalekjan, 5 years ago

by svihalekjan, 5 years ago

Attachment: ffmpeg-20190704-145519.log added

by svihalekjan, 5 years ago

Attachment: ffmpeg-20190704-140832.log added

by svihalekjan, 5 years ago

Attachment: input_file_mediainfo.txt added

comment:1 by Cigaes, 5 years ago

  • Is the video part necessary to observe the issue or can it be reproduced with simple PCM output, in WAVE or FLAC or anything?
  • Can you observe the differences on the output of the showinfo filter added after amerge?
  • Instead of merging the useful channels with synthetic silence, try to just merge the useful channels and then add empty channels using pan.

comment:2 by svihalekjan, 5 years ago

I am trying to upload a file to ffmpeg FTP server, but it seems to be down at this moment (connection times out every time I try).

in reply to:  1 comment:3 by svihalekjan, 5 years ago

Replying to Cigaes:

  • Is the video part necessary to observe the issue or can it be reproduced with simple PCM output, in WAVE or FLAC or anything?
  • Can you observe the differences on the output of the showinfo filter added after amerge?
  • Instead of merging the useful channels with synthetic silence, try to just merge the useful channels and then add empty channels using pan.

Thanks for quick reply, would you be so kind and show me structure of the ffmpeg command which I could use to do the third point?

comment:4 by Cigaes, 5 years ago

I think:

-vf "[0:a:0][0:a:1]amerge,pan=7.1|c0=c0|c1=c1

should just work, without anything about anullsrc.

in reply to:  4 comment:5 by svihalekjan, 5 years ago

Replying to Cigaes:

I think:

-vf "[0:a:0][0:a:1]amerge,pan=7.1|c0=c0|c1=c1

should just work, without anything about anullsrc.

Thanks, I am trying to do that with -af instead of -vf (is that right?) but receiving no audio output.

ffmpeg -i "audio_channel_mapping_issue_2_22.mxf" -map 0:v -y -c:v mpeg2video -s 1920x1080 -video_format pal -profile:v 0 -level:v 2 -r 25 -aspect 16:9 -flags +ildct -b:v 50000k -minrate 50000k -maxrate 50000k -af "[0:a:0][0:a:1]amerge,pan=7.1|c0=c0|c1=c1" -acodec pcm_s24le OUTPUT.mxf

I am probably forgetting about something here. Sorry, I have not encountered panning in ffmpeg yet.

comment:6 by Cigaes, 5 years ago

Of course, -af, my bad.

Does it work without the pan filter, producing stereo? If so, does it work better with FL= and FR= instead of c0= and c1=1?

comment:7 by svihalekjan, 5 years ago

Resolution: invalid
Status: newclosed

My bad, -af was not producing any audio for me, because I was also using mapping of video streams -map 0:v - in this case it is not really necessary, but I will have to use the mapping in future for different files.

With -af I was not able to mark the streams like [a] and then map them like -map "[a]". which is probably correct behavior.

However, I have found a way to use pan in filter_complex, which allows me to map audio/video streams like I need.

This is what works for me at the end:

-filter_complex "[0:a:0][0:a:1]amerge=inputs=2,pan=7.1|c0=c0|c1=c1[a]" -acodec pcm_s24le -map "[a]"

I cannot thank you enough Cigaes, your direction helped me a lot as I completely omitted using pan filter functionality which is exactly what I needed.

I am now closing this ticket as invalid as it is not really a bug, but my incompetence :)

Thanks again!

comment:8 by Cigaes, 5 years ago

You are right, -af could not work because the two input channels come from different streams. -af only works with a single stream input and output, and in that case, the argument for -map is just the selector for that stream.

On the other hand, I would still like to understand why the result of your original command changed between 4.0 and the current version. Your original command *should* work, and if it does not, it may really be a bug.

comment:9 by svihalekjan, 5 years ago

I have just tried to do the same with what is called in build repository as latest win64 static build: https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.zip

At the time I encountered (May-June) the issue it was the current build what was failing, but the current build now seems to be working actually (for both ways of audio channel mapping).

Version 0, edited 5 years ago by svihalekjan (next)

comment:10 by Cigaes, 5 years ago

Thanks.

Note: See TracTickets for help on using tickets.