Monthly Archives: January 2023

Trouble with Tria … playing with ffmpeg

We had an interesting problem this week. In one of our TV studios we have Ross Video’s Tria video server for playing clips and recording newscasts. Instructor who teaches TV production noticed that right audio channel was missing from exported mxf files when playing in VLC and editing in the Adobe Premiere Pro. My colleague contacted Ross Video, they were great, sent us a new updated firmware and we applied it. Exported the mxf file again and tested in VLC and our troubles of sidetracking began.

File that instructor was using is a static video of about 40 seconds in length. In the first 20 sec Jimi Hendrix is playing on the left channel, then in the last 20 sec Stevie Ray Vaughan is playing on the right.

Jimi on the left channel
Stevie on the right channel

When we first tested the exported mxf file in VLC, before the firmware upgrade, we could hear Jimi on the left only, but no Stevie on the right – silence. After the upgrade we could hear Jimi on both L and R, but again no Stevie at all! Ross Video was saying that files that we sent them (original jimi_left_stevie_right.clip and exported jimi_left_stevie_right.mxf) were OK. When we reimported mxf file into the Tria again, it was indeed OK playing from Tria. But it still wasn’t playing correctly in the VLC.

Problem was also seen before the firmware upgrade when the exported file from Tria was imported into the Adobe Premier Pro. Only left channel was there. After the Tria’s firmware upgrade, file was good in the Premiere Pro. So, instructor was happy, problem solved for him. But it still bothered me that VLC was doing it wrong.

In the mxf file that Tria exported VLC was seeing channel 1 (our left channel, Jimi) and channel 2 (our right channel, Stevie) as a separate mono audio streams. VLC can play only one track (stream) at a time, and by the default it’s Stream 1 – unless you start it from the command line as vlc --sout-all --sout #display , in which case you get both Jimi and Stevie on both L and R.

File originally exported from Tria

After some reading on FFMPEG and looking what others tried to do, found a post that was trying to solve similar problem. Below is my adaptation for our problem.

ffmpeg -i jimi_left_stevie_right.mxf \
-filter_complex "[a:0][a:1]amerge=inputs=2[ch1ch2]" \
-map 'v:0' \
-map '[ch1ch2]' \
-c:v copy \
-c:a pcm_s16le \
jimi_left_stevie_right_reordered.mxf

What’s happening here – video is being copied as-is, without transcoding. Two mono audio streams a:0 and a:1 are being merged as stereo and mapped into one stereo audio stream and re-encoded as pcm_s16le.

When processed like that, VLC plays it correctly and here’s what it sees.

File processed with ffmpeg

Notice that Stream 1 now has “Channels: Stereo”, while the original file exported from Tria had Streams 1 and 2 with “Channels: Mono” on both streams.

FFMPEG is a powerful tool with lots of options and I need to do a lots of reading to begin understanding most of them … I’ve got a work to do 🙂

Later … when imported in the Premiere Pro, both files look identical – Jimi on the left, Stevie on the right. Oh well … 🎸🤷‍♂️ … at least I learned how to manipulate audio tracks using ffmpeg.