<p>I found a solution to my problem:</p>

<p>Ffmpeg can use a http stream as input:</p>

<p><code>ffmpeg -i YoutubeVideoOnlyURLHere -i YoutubeAudioOnlyURLHere -c copy -map 0:0 -map 1:0 Path/to/outputFile.mp4</code></p>

<p>You can get the needed URLs from<br>
<code>youtube-dl -f bestvideo,bestaudio --get-url https:www.youtube.com/watch?v=XXXXXXXXXXX</code></p>

CC BY-SA 3.0
2017-01-04T18:04:43.140Z
2017-01-04T18:04:43.140Z
Atemu
<p>if this is the wrong place to post this let me know.</p>

<p>I want to download a very large video (9.1GiB) from youtube on my device and I have ~10GB free storage space for it.<br>
Because it's youtube, I have to download video and audio separately and combine them afterwards. I'd normally do that using ffmpeg. I'd have to let it create the combined video in a new ~9.1GiB file because it can't overwrite it's input. The video only file of similar size must exist during the whole process.<br>
Problem is: I can't store 2 9.1GiB files, only one.        </p>

<p>The possible solutions would be to edit the video only file to have an audio stream or have a super intelligent buffer system that'd delete the parts of the video only file that have already been copied into the new file.</p>

<p>Is there any program that is capable of doing that or do you know a different solution to this problem?<br>
-Atemu</p>

<p>(Sorry for my bad german)</p>

CC BY-SA 3.0
2016-09-28T21:08:04.267Z
There's no way to combine two files without making a third file, at least temporarily. But I don't understand why you think you need to do this -- surely you can just download one combined A/V file?
Jim Mack
CC BY-SA 3.0
2016-09-29T16:59:55.290Z
Everything above 720p 30fps h264 .mp4 and vp8 .webm is stored as DASH video and audio only files on youtube. Run `youtube-dl -F someyoutubevideolink` if you want to ccheck for yourself.
Atemu
CC BY-SA 3.0
2016-09-29T17:17:58.793Z
Using a tool like JDownloader 2 I seem to be able to d/l any video as a combined A/V file. Maybe I haven't encountered the files you're referring to: can you provide a specific link?
Jim Mack
CC BY-SA 3.0
2016-09-30T16:29:54.973Z
any youtube video that is in full HD or higher https://www.youtube.com/watch?v=iNJdPyoqt8U. I'm guessing JDownloader combines them automatically
Atemu
CC BY-SA 3.0
2016-09-30T18:05:30.730Z
Nope, works fine as is. There's a direct link to the 2160p .MP4 file. It's 667 MB in size. Try JDownloader 2, it's free.
Jim Mack
CC BY-SA 3.0
2017-01-04T18:29:08.197Z
jd comes bundled with a copy of ffmpeg and it muxes the DASH streams after download.
Gyan
<ffmpeg><youtube><storage>
Combine audio and video file without creating a 3rd file
Atemu
# Combine audio and video file without creating a 3rd file

(Asked by: username_0 on 2016-09-28)

if this is the wrong place to post this let me know.

I want to download a very large video (9.1GiB) from youtube on my device and I have ~10GB free storage space for it.  
Because it's youtube, I have to download video and audio separately and combine them afterwards. I'd normally do that using ffmpeg. I'd have to let it create the combined video in a new ~9.1GiB file because it can't overwrite it's input. The video only file of similar size must exist during the whole process.  
Problem is: I can't store 2 9.1GiB files, only one.

The possible solutions would be to edit the video only file to have an audio stream or have a super intelligent buffer system that'd delete the parts of the video only file that have already been copied into the new file.

Is there any program that is capable of doing that or do you know a different solution to this problem?  
-username_0

(Sorry for my bad german)

**Tags:** ffmpeg, youtube, storage

> **Comments:**
> **username_1**: There's no way to combine two files without making a third file, at least temporarily. But I don't understand why you think you need to do this -- surely you can just download one combined A/V file?  
> **username_0**: Everything above 720p 30fps h264 .mp4 and vp8 .webm is stored as DASH video and audio only files on youtube. Run `youtube-dl -F someyoutubevideolink` if you want to ccheck for yourself.  
> **username_1**: Using a tool like JDownloader 2 I seem to be able to d/l any video as a combined A/V file. Maybe I haven't encountered the files you're referring to: can you provide a specific link?  
> **username_0**: any youtube video that is in full HD or higher https://www.youtube.com/watch?v=iNJdPyoqt8U. I'm guessing JDownloader combines them automatically  
> **username_1**: Nope, works fine as is. There's a direct link to the 2160p .MP4 file. It's 667 MB in size. Try JDownloader 2, it's free.  
> **username_2**: jd comes bundled with a copy of ffmpeg and it muxes the DASH streams after download.  

---

## 1 answers

### Answer by username_0 on 2017-01-04. Score: 1 | Accepted answer

I found a solution to my problem:

Ffmpeg can use a http stream as input:

`ffmpeg -i YoutubeVideoOnlyURLHere -i YoutubeAudioOnlyURLHere -c copy -map 0:0 -map 1:0 Path/to/outputFile.mp4`

You can get the needed URLs from  
`youtube-dl -f bestvideo,bestaudio --get-url https:www.youtube.com/watch?v=XXXXXXXXXXX`


---

