How do I merge 4 videos into one? #8195

Closed
opened 2026-02-21 04:16:58 -05:00 by deekerman · 5 comments
Owner

Originally created by @hdubb on GitHub (Jul 9, 2016).

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.07.09.2. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.07.09.2

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

youtube-dl>youtube-dl -v http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', 'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2016.07.09.2
[debug] Python version 3.4.4 - Windows-10-10.0.10586
[debug] exe versions: ffmpeg N-80923-g50747d6, ffprobe N-80923-g50747d6
[debug] Proxy map: {}
[nick.com] pups-save-a-goldrush-s3-ep302-full-episode: Downloading webpage
[nick.com] a2223516-9d75-11e5-8ff7-0026b9414f30: Downloading info
[nick.com] 1f23f10c-067c-11e6-8a89-0026b9414f30: Extracting information
[nick.com] 1f23f10c-067c-11e6-8a89-0026b9414f30: Downloading video urls
[nick.com] 201571da-067c-11e6-8a89-0026b9414f30: Extracting information
[nick.com] 201571da-067c-11e6-8a89-0026b9414f30: Downloading video urls
[nick.com] 200f0944-067c-11e6-8a89-0026b9414f30: Extracting information
[nick.com] 200f0944-067c-11e6-8a89-0026b9414f30: Downloading video urls
[nick.com] 1fe03074-067c-11e6-8a89-0026b9414f30: Extracting information
[nick.com] 1fe03074-067c-11e6-8a89-0026b9414f30: Downloading video urls
[download] Downloading playlist: None
[nick.com] playlist None: Collected 4 video ids (downloading 4 of them)
[download] Downloading video 1 of 4
[debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/48/54/23078a3e674642be952c011667d04970/1151243/kEmxhGDpxZ_HDPAW302A1_1151243_6106051_1920x1080_5128.mp4'
[download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S1-1f23f10c-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded
[download] 100% of 152.47MiB
[download] Downloading video 2 of 4
[debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/49/05/2e74e7f82a4c459f8f2e854f7ff7b868/1151244/GQNG2u6Sqo_HDPAW302A2_1151244_6106051_1920x1080_5128.mp4'
[download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S2-201571da-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded
[download] 100% of 342.16MiB
[download] Downloading video 3 of 4
[debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/49/02/1ab39486dde94154a7eec2ba41fe1a40/1151245/v1xeC7lIrz_HDPAW302A3_1151245_6106051_1920x1080_5128.mp4'
[download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S3-200f0944-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded
[download] 100% of 142.71MiB
[download] Downloading video 4 of 4
[debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/49/00/7b1ed57260174dd09533a61fac9b63d2/1151246/qf5EdTiiUt_HDPAW302A4_1151246_6106051_1920x1080_5128.mp4'
[download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S4-1fe03074-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded
[download] 100% of 6.54MiB
[download] Finished downloading playlist: None

Description of your issue, suggested solution and other information

When I am downloading the video above, it brings out 4 different files, I just want 1 file. I guess it is doing that because there are ad breaks in between but I don't want ads either.

Originally created by @hdubb on GitHub (Jul 9, 2016). ## Please follow the guide below - You will be asked some questions and requested to provide some information, please read them **carefully** and answer honestly - Put an `x` into all the boxes [ ] relevant to your _issue_ (like that [x]) - Use _Preview_ tab to see how your issue will actually look like --- ### Make sure you are using the _latest_ version: run `youtube-dl --version` and ensure your version is _2016.07.09.2_. If it's not read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected. - [x] I've **verified** and **I assure** that I'm running youtube-dl **2016.07.09.2** ### Before submitting an _issue_ make sure you have: - [x] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections - [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones ### What is the purpose of your _issue_? - [ ] Bug report (encountered problems with youtube-dl) - [ ] Site support request (request for adding support for a new site) - [ ] Feature request (request for a new functionality) - [x] Question - [x] Other --- ### The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your _issue_ --- ### If the purpose of this _issue_ is a _bug report_, _site support request_ or you are not completely sure provide the full verbose output as follows: Add `-v` flag to **your command line** you run youtube-dl with, copy the **whole** output and insert it here. It should look similar to one below (replace it with **your** log inserted between triple ```): ``` youtube-dl>youtube-dl -v http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/ [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['-v', 'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/'] [debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252 [debug] youtube-dl version 2016.07.09.2 [debug] Python version 3.4.4 - Windows-10-10.0.10586 [debug] exe versions: ffmpeg N-80923-g50747d6, ffprobe N-80923-g50747d6 [debug] Proxy map: {} [nick.com] pups-save-a-goldrush-s3-ep302-full-episode: Downloading webpage [nick.com] a2223516-9d75-11e5-8ff7-0026b9414f30: Downloading info [nick.com] 1f23f10c-067c-11e6-8a89-0026b9414f30: Extracting information [nick.com] 1f23f10c-067c-11e6-8a89-0026b9414f30: Downloading video urls [nick.com] 201571da-067c-11e6-8a89-0026b9414f30: Extracting information [nick.com] 201571da-067c-11e6-8a89-0026b9414f30: Downloading video urls [nick.com] 200f0944-067c-11e6-8a89-0026b9414f30: Extracting information [nick.com] 200f0944-067c-11e6-8a89-0026b9414f30: Downloading video urls [nick.com] 1fe03074-067c-11e6-8a89-0026b9414f30: Extracting information [nick.com] 1fe03074-067c-11e6-8a89-0026b9414f30: Downloading video urls [download] Downloading playlist: None [nick.com] playlist None: Collected 4 video ids (downloading 4 of them) [download] Downloading video 1 of 4 [debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/48/54/23078a3e674642be952c011667d04970/1151243/kEmxhGDpxZ_HDPAW302A1_1151243_6106051_1920x1080_5128.mp4' [download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S1-1f23f10c-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded [download] 100% of 152.47MiB [download] Downloading video 2 of 4 [debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/49/05/2e74e7f82a4c459f8f2e854f7ff7b868/1151244/GQNG2u6Sqo_HDPAW302A2_1151244_6106051_1920x1080_5128.mp4' [download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S2-201571da-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded [download] 100% of 342.16MiB [download] Downloading video 3 of 4 [debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/49/02/1ab39486dde94154a7eec2ba41fe1a40/1151245/v1xeC7lIrz_HDPAW302A3_1151245_6106051_1920x1080_5128.mp4' [download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S3-200f0944-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded [download] 100% of 142.71MiB [download] Downloading video 4 of 4 [debug] Invoking downloader on 'http://viacommtvstrmfs.fplive.net/gsp.alias/mediabus/kids/.com/2016/04/25/04/49/00/7b1ed57260174dd09533a61fac9b63d2/1151246/qf5EdTiiUt_HDPAW302A4_1151246_6106051_1920x1080_5128.mp4' [download] PAW Patrol - 'Pups Save a Goldrush_Pups Save the Paw Patroller' S4-1fe03074-067c-11e6-8a89-0026b9414f30.mp4 has already been downloaded [download] 100% of 6.54MiB [download] Finished downloading playlist: None ``` --- ### Description of your _issue_, suggested solution and other information When I am downloading the video above, it brings out 4 different files, I just want 1 file. I guess it is doing that because there are ad breaks in between but I don't want ads either.
Author
Owner

@dstftw commented on GitHub (Jul 9, 2016):

Use ffmpeg/avconv.
No that's not because of ad breaks but because it's served as 4 separate files.
Duplicate of #2844.

@dstftw commented on GitHub (Jul 9, 2016): Use ffmpeg/avconv. No that's not because of ad breaks but because it's served as 4 separate files. Duplicate of #2844.
Author
Owner

@hdubb commented on GitHub (Jul 10, 2016):

@dstftw thanks. but what do I type in to merge them using ffmpeg?

@hdubb commented on GitHub (Jul 10, 2016): @dstftw thanks. but what do I type in to merge them using ffmpeg?
Author
Owner

@dstftw commented on GitHub (Jul 10, 2016):

@hdubb https://trac.ffmpeg.org/wiki/Concatenate.

@dstftw commented on GitHub (Jul 10, 2016): @hdubb https://trac.ffmpeg.org/wiki/Concatenate.
Author
Owner

@hdubb commented on GitHub (Jul 10, 2016):

@dstftw Thanks for those instructions.
I have 3 .mp4 files named 1.mp4, 2.mp4, and 3.mp4

This is what I am supposed to do right? It seems to work now that I updated the last line but it is converting mp4 to ts, then ts back to mp4, is that necessary?

ffmpeg -i 1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i 2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i 3.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts" -c copy -bsf:a aac_adtstoasc output.mp4

@hdubb commented on GitHub (Jul 10, 2016): @dstftw Thanks for those instructions. I have 3 .mp4 files named 1.mp4, 2.mp4, and 3.mp4 This is what I am supposed to do right? It seems to work now that I updated the last line but it is converting mp4 to ts, then ts back to mp4, is that necessary? ffmpeg -i 1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts ffmpeg -i 2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts ffmpeg -i 3.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts" -c copy -bsf:a aac_adtstoasc output.mp4
Author
Owner

@Reino17 commented on GitHub (Jul 10, 2016):

You have 3 mp4-files, or rather mp4-containers, each with a H264-videostream and an AAC-audiostream inside: [h264+aac] [h264+aac] [h264+aac].
In order to create 1 mp4-file with all the other 3 concatenated, you first have to extract the streams from it's container: h264+aac h264+aac h264+aac.
Then you can concat them together and put the newly formed audio- and videostream in a new mp4-container: [h264+aac|h264+aac|h264+aac].
So yes, the intermediate step is necessary. Unless you have a system that supports names pipes. Then you can do it in one go.

Btw, if you clearly specify .ts in the filename, then -f mpegts is not really necessary. Just like -f mp4 isn't necessary in the final step.

@Reino17 commented on GitHub (Jul 10, 2016): You have 3 mp4-files, or rather mp4-containers, each with a H264-videostream and an AAC-audiostream inside: `[h264+aac] [h264+aac] [h264+aac]`. In order to create 1 mp4-file with all the other 3 concatenated, you first have to extract the streams from it's container: `h264+aac h264+aac h264+aac`. Then you can concat them together and put the newly formed audio- and videostream in a new mp4-container: `[h264+aac|h264+aac|h264+aac]`. So yes, the intermediate step is necessary. Unless you have [a system that supports names pipes](https://trac.ffmpeg.org/wiki/Concatenate#protocol). Then you can do it in one go. Btw, if you clearly specify `.ts` in the filename, then `-f mpegts` is not really necessary. Just like `-f mp4` isn't necessary in the final step.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#8195
No description provided.