gpac icon indicating copy to clipboard operation
gpac copied to clipboard

Concatenation of mp4 files looses sound.

Open mgoldenbe opened this issue 6 years ago • 5 comments

I am trying to concatenate the following two files:

  • https://www.dropbox.com/s/oszkou1mpdek89w/part1.combined.mp4?dl=0
  • https://www.dropbox.com/s/pgsltpvnv4bkb0s/part2.combined.mp4?dl=0

I use the command: MP4Box -cat part1.combined.mp4 -cat part2.combined.mp4 out.mp4. (I tried other variants, such as -add for the first file, -force-cat and -keep-all)

The resulting file does not have voice for the second part. Both parts are screen captures created using the same settings to recordmydesktop. The mp3 audio tracks were recorded separately, but I made sure to make them suitable length (namely, I used the -info option to see the length of the video track and then exported a selection of that length from the audio track using audacity). The video and the audio tracks were merged by using MP4Box -new -add part1.video.mp4 -add part1.audio.mp3 part1.combined.mp4.

The output of MP4Box for concatenating the two parts:

Appending file part1.mp4 No suitable destination track found - creating new one (type vide) No suitable destination track found - creating new one (type soun) Appending file part2.mp4
No suitable destination track found - creating new one (type soun)

I saw this issue discussed, but have not seen a solution that would help in my case.

Version information (under Ubuntu 16.04 LTS):

MP4Box - GPAC version 0.7.2-DEV-rev357-g7115eeb-master GPAC Copyright (c) Telecom ParisTech 2000-2012 GPAC Configuration: Features: GPAC_64_BITS GPAC_HAS_SSL GPAC_HAS_SPIDERMONKEY GPAC_HAS_JPEG GPAC_HAS_PNG

UPDATE I have concatenated the files without a problem using the concat demuxer method from https://stackoverflow.com/a/11175851/2725810.

mgoldenbe avatar Dec 24 '17 09:12 mgoldenbe

Hi,

Thanks for reporting.

Happy to see you have a working solution. However make sure the duration and sync of your concatenated file is still ok. A full demux may lose this information.

For MP4Box I could reproduce your issue with the latest release. @jeanlf That's mp3 and the stsd also contains a btrt. The comparison (gf_isom_box_equal()) fails there. Ideas?

rbouqueau avatar Dec 27 '17 18:12 rbouqueau

ping @jeanlf

rbouqueau avatar Feb 20 '18 16:02 rbouqueau

now fixed, thanks for the report

jeanlf avatar May 18 '18 15:05 jeanlf

I am running into the same problem; no audio on my main clip when concating different video resolutions. I'd be happy if this could be solved :)

Raprodent avatar Feb 27 '22 08:02 Raprodent

@Raprodent Could you upload a sample to reproduce?

rbouqueau avatar Mar 06 '22 20:03 rbouqueau

closing (cannot reproduce), will reopen when we have files to reproduce the problem

jeanlf avatar Sep 28 '22 17:09 jeanlf

Hey again, just regarding the "subtitle fix". I have the newest Nightly Build, but the concat stops when there's a video with subtitles involved - it just pends in "analyzing format" mode. Do I have to pass on some additional command in CMD for the subtitles to make it to the final concat video?

Raprodent avatar Oct 11 '22 09:10 Raprodent

I cannot reproduce here, could you share sample files ?

jeanlf avatar Oct 11 '22 11:10 jeanlf

I cannot reproduce here, could you share sample files ?

They are quite large; but the situation is just that they should be concat'able - alas that the video with subtitles hinder any step beyond "importing format". AAC and H264 on both. With subtitles demuxed out of the video, everything works as expected.

Raprodent avatar Oct 11 '22 13:10 Raprodent

Yeah they should but there may be a bug. That's why we are all conversing here, right? :)

Could you please upload a sample at the place of your choice or here. Thanks

rbouqueau avatar Oct 11 '22 14:10 rbouqueau

With subtitles demuxed out of the video, everything works as expected.

If you remove both audio and video (keep only text) do you face the same problem when concatenating ?

jeanlf avatar Oct 11 '22 17:10 jeanlf

@rbouqueau - I'm in a tough spot delivering them atm. Best I can do for now is that description of 2 x H264 with AAC, and one of them has subtitles. Which leads to "hangup" on "importing formats".

@jeanlf - Do you mean concating 1 video with just 1 set of subtitles? Sorry that I'm noobish.

Raprodent avatar Oct 11 '22 18:10 Raprodent

Appreciate your dedication and patience! <3

Raprodent avatar Oct 11 '22 18:10 Raprodent