Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sound issue] when Join video different sample-rate and channel-count #77

Open
vfa-tuantt opened this issue Oct 18, 2017 · 3 comments
Open

Comments

@vfa-tuantt
Copy link

Hi,
I'm working on this library and i found a big problem. When i try to join 2 video with difference sample-rate and channel, the first video is normal but another video sound has problem (slowly sound or fast sound).
If you have any ideal please help me to resolve. Thanks alot
This is 2 information of my videos:

File 1:

mediaFormat = {MediaFormat@11768} "{aac-profile=2, mime=audio/mp4a-latm, channel-count=2, max-input-size=723, durationUs=25054331, csd-0=java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2], encoder-delay=1024, encoder-padding=0, sample-rate=44100}"
 mMap = {HashMap@11773}  size = 9
  0 = {HashMap$HashMapEntry@11777} "aac-profile" -> "2"
  1 = {HashMap$HashMapEntry@11778} "mime" -> "audio/mp4a-latm"
  2 = {HashMap$HashMapEntry@11779} "channel-count" -> "2"
  3 = {HashMap$HashMapEntry@11780} "max-input-size" -> "723"
  4 = {HashMap$HashMapEntry@11781} "durationUs" -> "25054331"
  5 = {HashMap$HashMapEntry@11782} "csd-0" -> "java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2]"
  6 = {HashMap$HashMapEntry@11783} "encoder-delay" -> "1024"
  7 = {HashMap$HashMapEntry@11784} "encoder-padding" -> "0"
  8 = {HashMap$HashMapEntry@11785} "sample-rate" -> "44100"

File 2:

mediaFormat = {MediaFormat@11730} "{max-input-size=358, aac-profile=2, mime=audio/mp4a-latm, durationUs=4160000, csd-0=java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2], channel-count=1, sample-rate=48000}"
 mMap = {HashMap@11735}  size = 7
  0 = {HashMap$HashMapEntry@11739} "max-input-size" -> "358"
  1 = {HashMap$HashMapEntry@11740} "aac-profile" -> "2"
  2 = {HashMap$HashMapEntry@11741} "mime" -> "audio/mp4a-latm"
  3 = {HashMap$HashMapEntry@11742} "durationUs" -> "4160000"
  4 = {HashMap$HashMapEntry@11743} "csd-0" -> "java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2]"
  5 = {HashMap$HashMapEntry@11744} "channel-count" -> "1"
  6 = {HashMap$HashMapEntry@11745} "sample-rate" -> "48000"
 shadow$_klass_ = {Class@7519} "class android.media.MediaFormat"
 shadow$_monitor_ = -2017511570
@vfa-tuantt vfa-tuantt changed the title [Soud issue when Join video different sample-rate and channel-count] [Soud issue] when Join video different sample-rate and channel-count Oct 18, 2017
@milkywayriver
Copy link

don't quite understand.when you say "video",do you mean "audio" ? because i see the MediaFormat was aac audio

@vfa-tuantt vfa-tuantt changed the title [Soud issue] when Join video different sample-rate and channel-count [Sound issue] when Join video different sample-rate and channel-count Nov 14, 2017
@vfa-tuantt
Copy link
Author

vfa-tuantt commented Nov 14, 2017

@milkywayriver
After i joined successfully 2 video into 1 video with different sample-rate and channel-count, but the sound of video was not good. The sound is just like the video is playing in high speed, just like Minion is talking. If you have any idea please help me to resolve that.
For example:
Video 1 with info: Duration = 15s, sample-rate = 44100, channel-count = 2
Video 2 with info: Duration = 15s, sample-rate = 48000, channel-count = 1

I joined Video 1 and Video 2 --> Video 3 (duration 30s) [Success]
But:
00s - 15s : The sound worked normally
16s - 30s: The sound didn't good. Like Minion is talking.

Sorry about my explanation. It's difficult to explain.
If you have any idea or solution for this issue, please help me. Thank you very much.

@sentox
Copy link

sentox commented Nov 28, 2017

I can only tell you that It's because these two Video's audio track has different sample-rate,it will cause the problem .you have to resample it to same sample-rate, m4m had a library calls libippresample.so, but I can't find it, you should try another way, If you success ,please tell me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants