<p>I used ffmpeg with only '-i' switch to figure out which stream was audio and which was video. Then executed the following to merge two audio channels and its video. </p>

<pre><code>ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -filter_complex "[1:0] [2:0] amerge" -c:v libx264 -c:a aac -strict experimental -qscale 0 -y  ../ffmpeg-att2.mp4
</code></pre>

<p>I think there can be more options by utilizing all four audio files to make stereo or surround. However, I stopped here as the output was acceptable. <br>Note - used '-qscale 0'  to limit quality-loss. </p>

CC BY-SA 4.0
2019-06-21T13:33:19.027Z
2019-06-21T13:33:19.027Z
anup
<p>On a recent video shoot, the camera man gave us output as .MXF files. Incidentally, Audio and Video are saved in separate .mxf files. 
<br><br>
eg:<br>
0007WA00.MXF - Audio  (<a href="https://paste.ubuntu.com/p/Hqrmwk6rf4/" rel="nofollow noreferrer">probe</a>)<br>
0007WA01.MXF - Audio  (<a href="https://paste.ubuntu.com/p/HnbFRZsFyR/" rel="nofollow noreferrer">probe</a>)<br>
0007WA02.MXF - Audio  (<a href="https://paste.ubuntu.com/p/WSvH7gZSFq/" rel="nofollow noreferrer">probe</a>)<br>
0007WA03.MXF - Audio  (<a href="https://paste.ubuntu.com/p/Y5MQRTfzbq/" rel="nofollow noreferrer">probe</a>)<br>
0007WA.MXF - Video  (<a href="https://paste.ubuntu.com/p/D7jXN4bgJT/" rel="nofollow noreferrer">probe</a>)<br></p>

<p>I am trying to figure out how to merge these in to a single video file. So far I couldn't find a way out.</p>

<p>[Edit: 20 Jun 2019]<br>
I managed to get audio and video stitched. However, audio is mono. Want a little clarity on whether I can have stereo or surround by utilizing the 4 audio files.</p>

<p>Command that worked:</p>

<pre><code>ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -i 0007WA02.MXF -i 0007WA03.MXF -c:v libx264 -c:a aac -strict experimental ../ffmpeg-stitch-mxf.mp4
</code></pre>

<p><em>Let me add that I am not an expert at this. Perhaps some may find my questions naive.</em> </p>

CC BY-SA 4.0
2019-06-19T17:41:37.087Z
What command did you try?
Gyan
CC BY-SA 4.0
2019-06-20T05:39:17.363Z
ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -i 0007WA02.MXF -i 0007WA03.MXF -c:v copy -c:a aac -strict experimental ../ffmpeg-stitch-mxf.mxf
anup
CC BY-SA 4.0
2019-06-20T05:40:24.343Z
that didn't work. However, gonna re-try with video codec too. Let's see if that works!
anup
CC BY-SA 4.0
2019-06-20T05:53:01.833Z
added an edit to the question.
anup
CC BY-SA 4.0
2019-06-20T10:46:58.480Z
Do you want to open the merged file in a professional video editor?
Gyan
CC BY-SA 4.0
2019-06-20T18:03:44.047Z
So the audio is 4 channels and they are supposed to play over the 1 video stream?  Seems that way, since they are all the same length, but just want to be clear. Gyan asks an important question: What do you want to do with the resultant file (e.g. post to YT, open in a editor for further processing, etc.)?
user3643
CC BY-SA 4.0
2019-06-20T18:04:45.693Z
A follow up on the audio channels: Are all of them actually used? I find that most times, only 1 or 2 channels are used. Can you verify that all files have content that you want?
user3643
CC BY-SA 4.0
2019-06-20T18:07:31.757Z
You probably need to look into the `-map` flag to get what you want. See this related question: [ffmpeg - mapping an audio file with 2 channels to a video file?](https://video.stackexchange.com/questions/18738/ffmpeg-mapping-an-audio-file-with-2-channels-to-a-video-file)
user3643
CC BY-SA 4.0
2019-06-21T08:31:58.543Z
Q: So the audio is 4 channels and they are supposed to play over the 1 video stream >> A: Yes |  Q: Gyan asks an important question: What do you want to do with the resultant file >> A: Eventually to Web. But, a video editor will process it before uploading. Processing = adding watermark, text, cut-n-merge etc.
anup
CC BY-SA 4.0
2019-06-21T08:34:08.333Z
Addon-Q: Why look at ffmpeg when there is a video editor? >> A: Video editor wants a format he/she can work with. The Panasonic camera for some reason recorded in MXF and with audio separate from video (courtesy camera man). Me, a Linux user is exploring solution to the given problem.
anup
CC BY-SA 4.0
2019-06-21T08:37:16.227Z
Suggestion: You probably need to look into the -map flag to get what you want. >> Reply:  That is what I did eventually. I wanted to post that as an answer, but I waited to see if some one gives a better solution. I used only two audio files in the merge. |  I think I should post that as an answer and let community enhance it, if there is scope.
anup
CC BY-SA 4.0
2019-06-21T14:45:16.970Z
Use `ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -i 0007WA02.MXF -i 0007WA03.MXF -map 0 -map 1 -map 2 -map 3 -map 4 -c copy merged.mov` to generate a file for the editor.
Gyan
<ffmpeg><mxf>
How to merge 4 Audio and 1 Video .MXF files in to one h.264 video file on Linux using ffmpeg?
anup
# How to merge 4 Audio and 1 Video .MXF files in to one h.264 video file on Linux using ffmpeg?

(Asked by: username_0 on 2019-06-19)

On a recent video shoot, the camera man gave us output as .MXF files. Incidentally, Audio and Video are saved in separate .mxf files. 

eg:
0007WA00.MXF - Audio  (probe)
0007WA01.MXF - Audio  (probe)
0007WA02.MXF - Audio  (probe)
0007WA03.MXF - Audio  (probe)
0007WA.MXF - Video  (probe)
I am trying to figure out how to merge these in to a single video file. So far I couldn't find a way out.
[Edit: 20 Jun 2019]
I managed to get audio and video stitched. However, audio is mono. Want a little clarity on whether I can have stereo or surround by utilizing the 4 audio files.
Command that worked:
ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -i 0007WA02.MXF -i 0007WA03.MXF -c:v libx264 -c:a aac -strict experimental ../ffmpeg-stitch-mxf.mp4

Let me add that I am not an expert at this. Perhaps some may find my questions naive.

**Tags:** ffmpeg, mxf

> **Comments:**
> **username_1**: What command did you try?  
> **username_0**: ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -i 0007WA02.MXF -i 0007WA03.MXF -c:v copy -c:a aac -strict experimental ../ffmpeg-stitch-mxf.mxf  
> **username_0**: that didn't work. However, gonna re-try with video codec too. Let's see if that works!  
> **username_0**: added an edit to the question.  
> **username_1**: Do you want to open the merged file in a professional video editor?  
> **username_2**: So the audio is 4 channels and they are supposed to play over the 1 video stream?  Seems that way, since they are all the same length, but just want to be clear. username_1 asks an important question: What do you want to do with the resultant file (e.g. post to YT, open in a editor for further processing, etc.)?  
> **username_2**: A follow up on the audio channels: Are all of them actually used? I find that most times, only 1 or 2 channels are used. Can you verify that all files have content that you want?  
> **username_2**: You probably need to look into the `-map` flag to get what you want. See this related question: [ffmpeg - mapping an audio file with 2 channels to a video file?](https://video.stackexchange.com/questions/18738/ffmpeg-mapping-an-audio-file-with-2-channels-to-a-video-file)  
> **username_0**: Q: So the audio is 4 channels and they are supposed to play over the 1 video stream >> A: Yes |  Q: username_1 asks an important question: What do you want to do with the resultant file >> A: Eventually to Web. But, a video editor will process it before uploading. Processing = adding watermark, text, cut-n-merge etc.  
> **username_0**: Addon-Q: Why look at ffmpeg when there is a video editor? >> A: Video editor wants a format he/she can work with. The Panasonic camera for some reason recorded in MXF and with audio separate from video (courtesy camera man). Me, a Linux user is exploring solution to the given problem.  
> **username_0**: Suggestion: You probably need to look into the -map flag to get what you want. >> Reply:  That is what I did eventually. I wanted to post that as an answer, but I waited to see if some one gives a better solution. I used only two audio files in the merge. |  I think I should post that as an answer and let community enhance it, if there is scope.  
> **username_1**: Use `ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -i 0007WA02.MXF -i 0007WA03.MXF -map 0 -map 1 -map 2 -map 3 -map 4 -c copy merged.mov` to generate a file for the editor.  

---

## 1 answers

### Answer by username_0 on 2019-06-21. Score: 0

I used ffmpeg with only '-i' switch to figure out which stream was audio and which was video. Then executed the following to merge two audio channels and its video. 
ffmpeg -i 0007WA.MXF -i 0007WA00.MXF -i 0007WA01.MXF -filter_complex "[1:0] [2:0] amerge" -c:v libx264 -c:a aac -strict experimental -qscale 0 -y  ../ffmpeg-att2.mp4

I think there can be more options by utilizing all four audio files to make stereo or surround. However, I stopped here as the output was acceptable. Note - used '-qscale 0'  to limit quality-loss.


---

