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

Merging video+audio. Output video wrong. #4580

Closed
degtyaryov opened this issue Dec 27, 2014 · 12 comments
Closed

Merging video+audio. Output video wrong. #4580

degtyaryov opened this issue Dec 27, 2014 · 12 comments

Comments

@degtyaryov
Copy link

@degtyaryov degtyaryov commented Dec 27, 2014

Hello.

$ youtube-dl -c --format 137+141 "http://www.youtube.com/watch?v=u3riQ3eHDy0" -o test.mp4

$ du -h test.mp4 
278M    test.mp4

Manually merging:

$ youtube-dl -c --format 137 "http://www.youtube.com/watch?v=u3riQ3eHDy0" -o test_video.mp4
$ du -h test_video.mp4
621M    test_video.mp4

$ youtube-dl -c --format 141 "http://www.youtube.com/watch?v=u3riQ3eHDy0" -o test_audio.mp4
$ du -h test_audio.mp4
52M     test_audio.mp4

$ ffmpeg -y -i test_video.mp4 -i test_audio.mp4 -c copy -map 0:v:0 -map 1:a:0 -shortest test_manually.mp4
$ du -h test_manually.mp4
278M    test_manually.mp4

Merging without -shortest:

$ ffmpeg -y -i test_video.mp4 -i test_audio.mp4 -c copy -map 0:v:0 -map 1:a:0 test_manually_without_shortest.mp4
$ du -h test_manually_without_shortest.mp4
672M    test_manually_without_shortest.mp4

Duration Video < Duration Audio:

$ ffprobe test_video.mp4 2>&1 | grep Duration
  Duration: 00:27:58.96, start: 0.000000, bitrate: 3099 kb/s
$ ffprobe test_audio.mp4 2>&1 | grep Duration
  Duration: 00:27:59.06, start: 0.000000, bitrate: 255 kb/s

$ ffprobe test_manually.mp4 2>&1 | grep Duration
  Duration: 00:27:59.06, start: 0.000000, bitrate: 1384 kb/s
$ ffprobe test_manually_without_shortest.mp4 2>&1 | grep Duration
  Duration: 00:27:59.06, start: 0.000000, bitrate: 3355 kb/s

How to remove -shortest?

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

I have a merge problem too. Maybe it's the same as this? In the merged output file the video cuts off (well, gets stuck on one frame) for the last 1/3 of the video. Is that what you're describing too?

It's a bit annoying to find out, that things went wrong, after downloading/archiving ~2000 videos.

@degtyaryov
Copy link
Author

@degtyaryov degtyaryov commented Dec 31, 2014

yes. 1/3 video and 3/3 audio.

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

See also issue #4220 if you haven't already.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Dec 31, 2014

It seems to work with ffmpeg 2.5.2, could you post the full output of youtube-dl -c --format 137+141 "http://www.youtube.com/watch?v=u3riQ3eHDy0" -o test.mp4 --verbose?

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

My full output of that command is:

DiskStation> youtube-dl -c --format 137+141 "http://www.youtube.com/watch?v=u3riQ3eHDy0" -o test.mp4 --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-c', '--format', '137+141', 'http://www.youtube.com/watch?v=u3riQ3eHDy0', '-o', 'test.mp4', '--verbose']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2014.12.17.2
[debug] Python version 2.7.9 - Linux-3.2.40-i686-with-glibc2.0
[debug] exe versions: ffmpeg 2.0.2
[debug] Proxy map: {}
[youtube] u3riQ3eHDy0: Downloading webpage
[youtube] u3riQ3eHDy0: Extracting video information
[youtube] u3riQ3eHDy0: Downloading DASH manifest
[debug] Invoking downloader on 'https://r4---sn-cgxqc55oq-caae.googlevideo.com/videoplayback?id=bb7ae24377870f2d&itag=137&source=youtube&requiressl=yes&mm=31&ms=au&mv=m&ratebypass=yes&mime=video/mp4&gir=yes&clen=650467330&lmt=1410840519374013&dur=1678.960&signature=6181F4AECDA3F426BBBB803BA340AEF990C9CE30.8F47CA63D1CC3FB12C70F4B5D3E97382704C189B&fexp=900718,927622,932404,9405581,9405619,943917,947209,947218,948124,952302,952605,952901,955301,957103,957105,957201&sver=3&upn=v6S01HMbO40&mt=1420040098&key=dg_yt0&ip=78.143.106.133&ipbits=0&expire=1420061756&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,ms,mv,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: test.f137.mp4
[download] 100% of 620.33MiB in 01:48
[debug] Invoking downloader on 'https://r4---sn-cgxqc55oq-caae.googlevideo.com/videoplayback?id=bb7ae24377870f2d&itag=141&source=youtube&requiressl=yes&mm=31&ms=au&mv=m&ratebypass=yes&mime=audio/mp4&gir=yes&clen=53532367&lmt=1410840440884345&dur=1679.058&signature=1C28EB8CAE138E503F7F003B4A2BE5FEBEF65210.45D28C8DA2F0553BB1B8AA65F7BBCCB72679425A&fexp=900718,927622,932404,9405581,9405619,943917,947209,947218,948124,952302,952605,952901,955301,957103,957105,957201&sver=3&upn=v6S01HMbO40&mt=1420040098&key=dg_yt0&ip=78.143.106.133&ipbits=0&expire=1420061756&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,ms,mv,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: test.f141.mp4
[download] 100% of 51.05MiB in 00:17
[ffmpeg] Merging formats into "test.mp4"
[debug] ffmpeg command line: ffmpeg -y -i test.f137.mp4 -i test.f141.mp4 -c copy -map 0✌️0 -map 1🅰️0 -shortest test.mp4
DiskStation>

How do I upgrade my ffmpeg? Does youtube-dl have it bundled or should I upgrade the regular one installed on my system?

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Dec 31, 2014

youtube-dl doesn't bundle ffmpeg, so you should upgrade the regular one.

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

That's going to be a problem then, I think. It's a Synology box with no real package manager except Synology's own "Package Center". Two community repositories have an ffmpeg package. One is version 2.2.1-1 and the other says 1.0-0005.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Dec 31, 2014

version 2.2 could work, try with it.

Since it's causing problems and it's not really needed (I think) we could remove the -shortest option.

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

The ffmpeg command still starts the old 2.0.2 version that comes default on the box.

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

I got it. I just moved /usr/local/bin in front of /usr/bin in the PATH variable. Now it uses the correct ffmpeg.

Will post with the youtube-dl download result in a minute...

@clb92
Copy link

@clb92 clb92 commented Dec 31, 2014

And it works! The video stream now works all the way to the end.

Thank you very much for your help, and have a happy new years eve!

@jaimeMF jaimeMF closed this in bc3e582 Jan 4, 2015
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jan 4, 2015

In the next version it won't use the -shortest option.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.