[FFmpeg-user] more sound madness

Bouke / VideoToolShed bouke at videotoolshed.com
Mon Mar 9 15:09:21 EET 2020

> On 09 Mar 2020, at 07:16, Ted Park <kumowoon1025 at gmail.com> wrote:
> Hello,
>> Did you try it in Premiere, and got all the channels? Or open the output in old QT pro, and look at the properties.
>> The last channels are disabled. If I enable them and save the file (destructive), a new MOOV atom is added and the current one is flagged as FREE.
>> Then Premiere will accept it as it ‘should’ be.
>> (Warning, Premiere has  a nasty habit to ‘remember’ files. Once it has seen a specific file, it will use the properties of the first import, even when you change it and re-import.)
> Premier yes, QuickTime Pro I can’t run anymore. It starts importing all tracks in Premier, and plays all tracks by default in Quicktime Player. For a simple change I opened the file in a hex editor and set/cleared the bits by hand, each track had a flag at their track header “tkhd” box, 0x000001 enables, 0x000002 sets whether it’s part of the main presentation, etc.

Hi Ted,
Ok, that’s what I’m seeing as well! (Now, I did not know that the track header contained this info, but indeed, the muted tracks show 0x000002, setting them  to 0x000003 fixes the issue!
This is going to be my backup plan!

> (If you set premier to cache metadata to a separate sidecar file alongside media files it can take the guesswork out at least, just delete the xmp to force a refresh)

Good one! Never thought of that.

> I think I see what you are getting though, when I disabled tracks manually they just disappeared from the list in QT, but they were still there, just impossible to see. All ten still imported fine in Premier though.

Not sure what version you are using but it does not on my end...
But, it seems easy enough to fix. (Although I still think this is a FFmpeg bug…)

> I’m wondering what’s causing the different behavior though…
>>> % ffmpeg -i /Volumes/Data/test/C0092.MP4 -i /Volumes/Data/test/068.WAV -filter_complex “[0:1]pan=1c|c0=c1[o1];[1:0]pan=1c|c0=c9[o2];[1:0]pan=1c|c0=c10[o3]” -map “[o1]" -map “[o2]" -map “[o3]"
>>> -c:a pcm_s24le -map 0:0 -c:v copy -shortest /Volumes/Data/test/last2muted.mov -y
>> This gives me exactly the same issue.
> Huh, have you tried switching the order of the input files? I think it’s possible ffmpeg doesn’t bother to check for possibly more channels being used in the filters after guessing stereo from the first input since it’s never actually told otherwise about channels or layouts...
>> Guessed Channel Layout for Input Stream #0.1 : stereo
>> Now, I can live with all the sound channels in one track, only reason I’m pursuing this is that I can’t remap more than about 8 channels into a single poly track.
>> (See my post from a few days ago…)
> Actually could using something other than pan sidestep the whole disabling output streams issue?
> % ffmpeg -i /Volumes/Data/test/C0092.MP4 -i /Volumes/Data/test/068.WAV -filter_complex “[0:1]pan=1c|c0=c1[o1];[1:0]pan=1c|c0=c9[o2];[1:0]pan=1c|c0=c10[o3]” -map “[o1]" -map “[o2]" -map “[o3]"
> -c:a pcm_s24le -map 0:0 -c:v copy -shortest /Volumes/Data/test/last2muted.mov -y

Same muted tracks, but now I know how to fix them:

Now for the main course:
> % ffmpeg -i /Volumes/Data/test/068.WAV -i /Volumes/Data/test/C0092.MP4 -filter_complex "[0:a]channelmap=map=0-0|1-1:channel_layout=0x60000000,[1:a]join=inputs=2:channel_layout=0x60020000,channelmap=map=0-0|1-1|2-2:channel_layout=0x60020000[out]" -map "[out]" -c:a pcm_s24le -map 0:0 -c:v copy -shortest -y output.mov

This looks promising, but I can’t grasp the filter_complex:
If I break it down:
> "[0:a]
Use sound from input 0

> channelmap=map=0-0|1-1
map channel 0 to output 0, channel 1 to output 1

> :channel_layout=0x60000000,
I take it this is means the binary value, in this case 0 1 1 0 0 0 0 0 0 etc 
But this is output? (It looks like ‘max 32 channels out, use 1 and 2, leave room to insert the sound from the video at 0? And the mapping auto inserts the tracks to the first available slots? (Or how it is called…))

> [1:a]join=inputs=2
Use sound from input 1, start joining that, so total 2 streams input.

> :channel_layout=0x60020000,
Now I’m totally lost. This states 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
What am I supposed to see here? Start is the same, but then I’m lost...

> channelmap=map=0-0|1-1|2-2:
This also confuses me. The order of the second and third mapping looks likes it comes from the 0 1 1 yadda at the beginning.
But where is channel 0 from the second input mapped? Whatever I try, I always end up with channel 0...

> channel_layout=0x60020000[out]”



> Regards,
> Ted Park
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list