4

Ok so I have a video made from dxtory. The video is using dxtory video codec and unknown audio codec. When I pop the file into avimux, I can clearly see two audio tracks/sources. I have successfully converted the video without loss of quality with the following.

ffmpeg -i "The Bunker.avi" -vcodec h264 TheBunkerMix.mp4

But, the resultant file only had one track/source. Basically I recorded game footage and the original file had both the in game sounds as well as the mic recording commentary on top. But, when I did the conversion my audio commentary track/source got lost in conversion. What other options can I include to get my audio tracks?

EDIT 2:

I've gotten close now, but still not right. I have used the following but again its seems to ignore the first -map option. If I flipped which map comes second, that is the stream that is audible in the output. How do I mux them together so they both play?

ffmpeg -i "The Bunker.avi" -map 0:0 -map 0:1 -map 0:2 -vcodec h264 -acodec:0 mp
 -acodec:1 mp3 TheBunkerNwMix.mp4

This is the stream mappings so I have no idea why it isn't mapping correctly?

Stream mapping:
  Stream #0:0 -> #0:0 (dxtory -> libx264)
  Stream #0:1 -> #0:1 (pcm_s16le -> libmp3lame)
  Stream #0:2 -> #0:2 (pcm_s16le -> libmp3lame)
2
  • Do you want to keep both audio tracks and just convert the file so it can be used in an editing program or do you want to mix both audio files into one?
    – timonsku
    Jun 29, 2014 at 21:44
  • Yes I basically want a small mp4 that I can edit with, without loss of audio.
    – Kyle
    Jun 30, 2014 at 15:31

2 Answers 2

6

If you copied your command there then your issue is probably -acodec:0 mp. That should be -acodec:0 mp3.

You can just use -c:a mp3 to apply the encoding options to all audio tracks at once, no need to apply them for each individually.

Other than that your mapping is correct and shouldn't be the issue.

Edit: To conclude the discussion in the comments regarding the actual reason behind the question: When it comes to editing it is no problem to just transcode the video stream if the source codec makes problems and import the audio from the source file by either muxing the audio into a new container with the transcoded video stream or just importing the transcoded video and audio streams separately (by demuxing the source) into your editing program and skip on the container format.

8
  • Is it possible that its a playback problem inside of wmp?
    – Kyle
    Jun 30, 2014 at 15:31
  • definitely, Windows Media Player is bad, really really bad when it comes to format compatibility. Try VLC or Media Player Classic Home Cinema.
    – timonsku
    Jun 30, 2014 at 16:23
  • Ok I will give that a shot when I get home later. If it does work there, is it safe to assume it would import correctly into Premiere?
    – Kyle
    Jun 30, 2014 at 16:35
  • Not necessarily when it comes to codecs but in the case of several audio tracks, yes it should. Though if you just want to edit it, you can just import the file like it is into Premiere, h264 is really not suitable for editing and degrades quality if you recorded with dxtory's lossless codec (h264 is highly lossy compressed). The codec should integrate into the Windows AVI codecs so Premiere would be able to use it. Edit: It does, you can just import the recordings without transcoding.
    – timonsku
    Jun 30, 2014 at 17:12
  • Really? That is interesting. But, the file size is definitely a problem. 60 GB video file is not so easy to transfer, but I can probably give it a shot.
    – Kyle
    Jun 30, 2014 at 19:13
1

Your "mp" codec would be the reason why only one track may be in the output file; there's no "mp" codec (looks like a typo).

If stream mapping is showing both audio tracks are present in the output file, then you should be able to select which track to play in the video player. By default, the best or first supported audio will play.

If you want both audio tracks to play ("mux them together so they both play"), then mix the audio into one track.

Here's how -c (select codecs) & -map (select streams) options work:

-c:a -> select best supported audio (transcoded)
-c:a copy -> best supported audio (copied)
-map 0:a -> all audio from 1st input file (transcoded)
-map 0:0 -> 1st stream from 1st input file (transcoded)
-map 1:a:0 -> 1st audio stream from 2nd input file (transcoded)
-map 1:a:1 -c:a copy -> 2nd audio stream from 2nd input file (copied)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.