glabifrons
New Member
I apologize in advance if I'm weak on some of the terminology. I'm a greybeard with tech, but a newb with AV recording/editing. I'm also not sure that this is a Linux issue, but I don't see a general forum for bug/issue discussion.
TL;DR: My most recent recordings have multiple audio tracks, and when I extract the audio tracks using either mkvextract or ffmpeg, they all have different lengths from the video and each-other. One example is ~40 seconds off over an hour. How can I extract the alternate audio tracks and keep them in sync?
Short description:
I just started doing some game recordings with separate tracks for the game and my microphone so I could do some post-recording rebalancing, and I ran into a problem. All of the videos (mkv) contain tracks with all different lengths, or at least that's how then end up after extraction (maybe some metadata external to the track is being missed during extraction?).
I've googled more than a little trying to solve this before coming here. One suggestion I saw in a thread with a person with a similar problem was to remux. I tried that, but the mp4 then had tracks with different lengths, so same problem, different container. Another suggestion was to use the Use Device Timestamps option in the input device configuration, but this version (current/stable) of the software does not appear to have that option.
My OBS Studio configuration:
Audio track 1 is game audio and mic already mixed.
Audio track 2 is game audio only.
Audio track 3 is microphone audio only (Plantronics headset).
Format is mkv.
Encoder is set to "(use stream encoder)".
Audio bitrates are all left stock at 160.
Sample rate is 44.1khz.
Details:
I'm using OpenShot for editing as it was the easiest I've tried, but unfortunately, it doesn't appear to support anything other than the primary audio track. If you have suggestions for video editing software which runs on Linux that may solve this issue, I'm open to them.
I extracted the second and third audio tracks using mkvextract's "tracks" option, which seemed extremely straightforward. I tried extracting the tracks to wav and aac, with and without the "-f" option, all with the same results.
When imported into OpenShot, one video (for example) was 00:10:03:01 long, while the second audio track was 00:09:14:03 and the third was 00:10:03:14 long (this is as close as I can tell with the granularity of OpenShot's GUI).
If I align the ends of the recordings, the beginning is way off. If I audibly align the recordings (aligning a sound with a graphic in the video) at the beginning (yes, it's off by a second or so), the audio at the end is horribly off. It appears some stretching and/or length-compression is needed, but I'm not sure why (or how, for that matter).
Another recording contained video which was 1:12:40:23 long, while audio track 2 was 1:12:04:01 long and audio track 3 was 1:12:44:08 long, a spread of ~40 seconds over an hour.
As mentioned above, I also used the "Remux Recordings" option to convert an mkv file to mp4, then used ffmpeg's "copy" audio codec to extract the tracks with the same results as the above.
Questions:
While writing up the below questions, it occurred to me to check the alternate tracks using VLC and it turns out they stay in sync when played from the original recording. There are also random audio drops, those I noticed in previous (non-multi-track) recordings I've done (and posted) previously.
Am I extracting the audio incorrectly? What do you recommend?
Is there metadata in the mkv which keeps the audio in sync? There must be, else VLC wouldn't be able to play it back in sync.
I'm mainly looking for a way to extract the audio while keeping it in sync, but am also interested in eliminating the audio drops I'm experiencing.
Software and hardware:
My OBS Studio is the current stable version (20.1.0).
My OS is Ubuntu MATE 16.04 LTS (fully up to date).
My rig is an i7-4790K with 32GB of DDR3/2400 RAM. There are only 5 CPUs made with faster thread performance, and the difference between this and the fastest (which is 4 generations newer) is less than 8%, so CPU performance should not be a problem.
My card is an EVGA GTX 950 FTW edition (~20% faster clocks than spec GTX 950), so not a monster, but it hasn't reached peak load during recordings either, at least it's never been when I've checked.
Audio is via Realtek ALC1150 in the GIGABYTE GA-Z97X-UD3H motherboard (I've had no audio issues at all with this outside of OBS Studio recordings).
Storage is via NFSv4 on a Solaris 11.3 server using ZFS with SSD ZIL & L2ARC (separate SSDs for write and read caches) backed by striped and mirrored 4TB 7200RPM drives so storage speed should not be an issue. Besides, the video is far higher bandwidth and is unaffected.
Examples of audio drops in single-track recordings (possibly related to the above) can be heard in game recordings on https://www.youtube.com/channel/UC8VoVhoSa3s8m47yxdOztRA.
A specific example would be at 1:35 and again at 2:05, 2:13, 2:20, 2:22, 2:33, 2:34, 2:36, 2:56, 2:58, etc. in https://www.youtube.com/watch?v=GaOIvkC11Gs.
Note that the video stalls are actually from the game and not from OBS, that's exactly how the game plays (I've seen a lot of people with far higher end rigs than mine with the exact same game video stalling issue (they play on Windows and use different recording software), the game is in Early Access and under heavy development).
Edit: Changed "all of my" to "my most recent" in the TL;DR.
TL;DR: My most recent recordings have multiple audio tracks, and when I extract the audio tracks using either mkvextract or ffmpeg, they all have different lengths from the video and each-other. One example is ~40 seconds off over an hour. How can I extract the alternate audio tracks and keep them in sync?
Short description:
I just started doing some game recordings with separate tracks for the game and my microphone so I could do some post-recording rebalancing, and I ran into a problem. All of the videos (mkv) contain tracks with all different lengths, or at least that's how then end up after extraction (maybe some metadata external to the track is being missed during extraction?).
I've googled more than a little trying to solve this before coming here. One suggestion I saw in a thread with a person with a similar problem was to remux. I tried that, but the mp4 then had tracks with different lengths, so same problem, different container. Another suggestion was to use the Use Device Timestamps option in the input device configuration, but this version (current/stable) of the software does not appear to have that option.
My OBS Studio configuration:
Audio track 1 is game audio and mic already mixed.
Audio track 2 is game audio only.
Audio track 3 is microphone audio only (Plantronics headset).
Format is mkv.
Encoder is set to "(use stream encoder)".
Audio bitrates are all left stock at 160.
Sample rate is 44.1khz.
Details:
I'm using OpenShot for editing as it was the easiest I've tried, but unfortunately, it doesn't appear to support anything other than the primary audio track. If you have suggestions for video editing software which runs on Linux that may solve this issue, I'm open to them.
I extracted the second and third audio tracks using mkvextract's "tracks" option, which seemed extremely straightforward. I tried extracting the tracks to wav and aac, with and without the "-f" option, all with the same results.
When imported into OpenShot, one video (for example) was 00:10:03:01 long, while the second audio track was 00:09:14:03 and the third was 00:10:03:14 long (this is as close as I can tell with the granularity of OpenShot's GUI).
If I align the ends of the recordings, the beginning is way off. If I audibly align the recordings (aligning a sound with a graphic in the video) at the beginning (yes, it's off by a second or so), the audio at the end is horribly off. It appears some stretching and/or length-compression is needed, but I'm not sure why (or how, for that matter).
Another recording contained video which was 1:12:40:23 long, while audio track 2 was 1:12:04:01 long and audio track 3 was 1:12:44:08 long, a spread of ~40 seconds over an hour.
As mentioned above, I also used the "Remux Recordings" option to convert an mkv file to mp4, then used ffmpeg's "copy" audio codec to extract the tracks with the same results as the above.
Questions:
While writing up the below questions, it occurred to me to check the alternate tracks using VLC and it turns out they stay in sync when played from the original recording. There are also random audio drops, those I noticed in previous (non-multi-track) recordings I've done (and posted) previously.
Am I extracting the audio incorrectly? What do you recommend?
Is there metadata in the mkv which keeps the audio in sync? There must be, else VLC wouldn't be able to play it back in sync.
I'm mainly looking for a way to extract the audio while keeping it in sync, but am also interested in eliminating the audio drops I'm experiencing.
Software and hardware:
My OBS Studio is the current stable version (20.1.0).
My OS is Ubuntu MATE 16.04 LTS (fully up to date).
My rig is an i7-4790K with 32GB of DDR3/2400 RAM. There are only 5 CPUs made with faster thread performance, and the difference between this and the fastest (which is 4 generations newer) is less than 8%, so CPU performance should not be a problem.
My card is an EVGA GTX 950 FTW edition (~20% faster clocks than spec GTX 950), so not a monster, but it hasn't reached peak load during recordings either, at least it's never been when I've checked.
Audio is via Realtek ALC1150 in the GIGABYTE GA-Z97X-UD3H motherboard (I've had no audio issues at all with this outside of OBS Studio recordings).
Storage is via NFSv4 on a Solaris 11.3 server using ZFS with SSD ZIL & L2ARC (separate SSDs for write and read caches) backed by striped and mirrored 4TB 7200RPM drives so storage speed should not be an issue. Besides, the video is far higher bandwidth and is unaffected.
Examples of audio drops in single-track recordings (possibly related to the above) can be heard in game recordings on https://www.youtube.com/channel/UC8VoVhoSa3s8m47yxdOztRA.
A specific example would be at 1:35 and again at 2:05, 2:13, 2:20, 2:22, 2:33, 2:34, 2:36, 2:56, 2:58, etc. in https://www.youtube.com/watch?v=GaOIvkC11Gs.
Note that the video stalls are actually from the game and not from OBS, that's exactly how the game plays (I've seen a lot of people with far higher end rigs than mine with the exact same game video stalling issue (they play on Windows and use different recording software), the game is in Early Access and under heavy development).
Edit: Changed "all of my" to "my most recent" in the TL;DR.