TeamNewPipe/NewPipe

[PeerTube] The downloader can't combine/mux two fragmented MP4 files

Open

#12,443 opened on Jul 19, 2025

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Java (3,577 forks)batch import
PeerTubebugdownloaderhelp wanted

Repository metrics

Stars
 (38,153 stars)
PR merge metrics
 (Avg merge 9d 17h) (17 merged PRs in 30d)

Description

Checklist

  • I am able to reproduce the bug with the latest version given here: CLICK THIS LINK.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have read the FAQ and my problem isn't listed.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I have read and understood the contribution guidelines.

Affected version

0.28.0

Steps to reproduce the bug

See #11601. The downloader is unable to combine/mux two segmented MP4 files and will generate a file with only audio and with strange intermittent silences. ffmpeg can combine the two files without issues. These two PeerTube videos are examples: https://peertube.qontinuum.space/w/k2wKrFgGpoSSrGTCkkjoLC https://video.blast-info.fr/w/87GhAwHborpk5Kym1eqZ6m . To make the download dialog provide the option to download video+audio, change the following in SecondaryStreamHelper:

Turn this:

        } else if (mediaFormat == MediaFormat.MPEG_4) {
            return audioStreams
                    .stream()
                    .filter(audioStream -> audioStream.getFormat() == MediaFormat.M4A)
                    .max(ListHelper.getAudioFormatComparator(MediaFormat.M4A,
                            ListHelper.isLimitingDataUsage(context)))
                    .orElse(null);

into this:

        } else if (mediaFormat == MediaFormat.MPEG_4) {
            return audioStreams
                    .stream()
                    .filter(audioStream -> audioStream.getFormat() == MediaFormat.M4A
                            || audioStream.getFormat() == MediaFormat.MPEG_4)
                    .max(ListHelper.getAudioFormatComparator(MediaFormat.M4A,
                            ListHelper.isLimitingDataUsage(context)))
                    .orElse(null);

It would be good if someone who has some experience with the MP4 format (standard ISO/IEC 14496-12) could work on this.

Contributor guide