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

youtube-dl failing to merge formats via ffmpeg #147

Closed
viticci opened this Issue Dec 1, 2018 · 11 comments

Comments

Projects
None yet
4 participants
@viticci
Copy link

viticci commented Dec 1, 2018

After downloading separate video and audio tracks for a video via youtube-dl with the following command:

youtube-dl -f 313+251 https://www.youtube.com/watch?v=JiwIuWFLv-U

iSH fails to merge formats at the end, returning the following encoder error via ffmpeg:

[youtube] JiwIuWFLv-U: Downloading webpage                                                                                                                                                
[youtube] JiwIuWFLv-U: Downloading video info webpage                                                                                                                                     
[download] Destination: What's on my iPad Pro!-JiwIuWFLv-U.f313.webm                                                                                                                      
[download] 100% of 677.26MiB in 07:48                                                                                                                                                     
[download] Destination: What's on my iPad Pro!-JiwIuWFLv-U.f251.webm                                                                                                                      
[download] 100% of 8.06MiB in 00:05                                                                                                                                                       
[ffmpeg] Merging formats into "What's on my iPad Pro!-JiwIuWFLv-U.webm"                                                                                                                   
ERROR: Unknown encoder 'copy'

For context, here is the successful output for the same command from macOS:

[youtube] JiwIuWFLv-U: Downloading webpage
[youtube] JiwIuWFLv-U: Downloading video info webpage
[download] Resuming download at byte 85454848
[download] Destination: What's on my iPad Pro!-JiwIuWFLv-U.f313.webm
[download] 100% of 677.26MiB in 01:23
[download] Destination: What's on my iPad Pro!-JiwIuWFLv-U.f251.webm
[download] 100% of 8.06MiB in 00:01
[ffmpeg] Merging formats into "What's on my iPad Pro!-JiwIuWFLv-U.webm"
Deleting original file What's on my iPad Pro!-JiwIuWFLv-U.f313.webm (pass -k to keep)
Deleting original file What's on my iPad Pro!-JiwIuWFLv-U.f251.webm (pass -k to keep)
@cliss

This comment has been minimized.

Copy link

cliss commented Dec 1, 2018

To my eyes, based on nothing but a hunch, this has nothing to do with youtube-dl and everything to do with ffmpeg. (@viticci implied this above.)

For the life of me, I can't understand how the copy coder couldn't be available, and nothing that's unique to iSH should cause an error like this.

Furthermore, I did a cursory search of the ffmpeg repo to see if I could find the string Unknown encoder but came up short.

The best I can guess is that there is some sort of deeper error which is being reported as a missing encoder...? ¯\(ツ)

@Drvolks

This comment has been minimized.

Copy link

Drvolks commented Dec 1, 2018

You’re right it’s a ffmpeg issue.

ffmpeg -i video.mp4 -i audio.m4a -c:v copy -c:a copy output.mp4

Will result in the same « Unknown encoder 'copy' » error.

-loglevel debug doesn’t reveal any hint on the underlying issue:

Successfully opened the file.                                                                                                                          
Parsing a group of options: output url output.mp4.                                                                                                     
Applying option c:v (codec name) with argument copy.                                                                                                   
Applying option c:a (codec name) with argument copy.                                                                                                   
Successfully parsed a group of options.                                                                                                                
Opening an output file: output.mp4.                                                                                                                    
Unknown encoder 'copy'            
@tbodt

This comment has been minimized.

Copy link
Owner

tbodt commented Dec 1, 2018

This smells like some kind of subtle CPU bug that takes a day to debug and is fixed by changing 1 character.

@tbodt

This comment has been minimized.

Copy link
Owner

tbodt commented Dec 7, 2018

I just tried ffmpeg on the "you've been gnomed" video and it seems to be working now. Maybe there was an ffmpeg update? Maybe it's only broken on aarch64? (likely)

@cliss

This comment has been minimized.

Copy link

cliss commented Dec 8, 2018

Just apk del’d everything and then re-added it, and still can’t use the copy encoder.

So weird.

@tbodt

This comment has been minimized.

Copy link
Owner

tbodt commented Dec 8, 2018

It's definitely an arm64-specific CPU bug, it doesn't work on iOS but it does work on my computer

@tbodt

This comment has been minimized.

Copy link
Owner

tbodt commented Dec 9, 2018

Fixed now, it was a screwup in 8-bit string compares.

@tbodt tbodt closed this Dec 9, 2018

@cliss

This comment has been minimized.

Copy link

cliss commented Dec 9, 2018

@tbodt

  1. Thanks!! Stoked to try it!!
  2. Purely out of curiosity, was 5b4807c the commit that fixed it?
  3. # setting flags: a horror story 🤣 you write comments like I do
@tbodt

This comment has been minimized.

Copy link
Owner

tbodt commented Dec 9, 2018

Yup, 5b4807c was the fix. Checking overflow on 8-bit subtraction on arm64 is the third hard problem in computer science.

@cliss

This comment has been minimized.

Copy link

cliss commented Dec 9, 2018

Hahahahahahahaha 🤣🤣🤣

@cliss

This comment has been minimized.

Copy link

cliss commented Dec 9, 2018

Excuse me for being a bit over enthusiastic, but...

OMFG IT WORKS AND IT’S SO DAMN FAST LOOK AT THIS

frame= 2844 fps=221 q=-1.0 Lsize=  257424kB time=00:01:34.84 bitrate=22233.7kbits/s speed=7.38x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment