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

Converting audio and merging files #16500

Closed
jpmorgancalled opened this issue May 20, 2018 · 1 comment
Closed

Converting audio and merging files #16500

jpmorgancalled opened this issue May 20, 2018 · 1 comment
Labels

Comments

@jpmorgancalled
Copy link

@jpmorgancalled jpmorgancalled commented May 20, 2018

I am trying to download separate ISM audio and ISM video sources and merge them together. The ISMA audio file, when played, has periodic gaps, presumably between each fragment. To prevent these gaps, I have to explicitly convert the audio file to MP3 or something, then merge it with the ISMV file using ffmpeg. Is there a way to do the audio format conversion and audio+video merge as part of youtube-dl's arguments, rather than using ffmpeg commands manually?

Something like this:

youtube-dl -f bestvideo+bestaudio "....ism/manifest(filter=trimmed1)?..." --audio-format mp3 --merge-output-format mp4 --output filename

(This command does not work. the gap-filled ISMA audio is clearly being used in the output MP4 file.)

There is also a separate but related problem related to merging audio and video: In the original streaming video source, the audio begins about 2 seconds before the video. (For the first 2 seconds, only the first frame of the video is shown, a static image.) As a result, in the merged audio+video file, the audio appears about 2 seconds later than it should. Does youtube-dl have a graceful way of dealing with this audio lag? Acceptable answers would be command-line options for either including a black screen or frozen image for the first 2 seconds of video, or sacrificing the first 2 seconds of audio.

@jpmorgancalled
Copy link
Author

@jpmorgancalled jpmorgancalled commented May 20, 2018

For reference, my current method for merging audio+video is to download the audio and convert it to MP3:

youtube-dl -f audio-96 "....ism/manifest(filter=trimmed1)?..."
ffmpeg -i filename.isma -acodec libmp3lame filename.mp3

Or, alternatively, download the audio and convert it to MP3 in one step:
youtube-dl -f audio-96 "....ism/manifest(filter=trimmed1)?..." --extract-audio --audio-format mp3

Either way, I then merge the MP3 and ISMV files:
ffmpeg -i filename.ismv -i filename.mp3 -c:v copy -c:a copy filename.mp4

Another alternative is to download the unconverted ISMA audio, but to convert it to, say, AAC along the way:
ffmpeg -i filename.ismv -i filename.isma -c:v copy -c:a aac -strict experimental filename.mp4

None of these commands addresses the audio lag issue I mentioned in the second part of my original post.

@dstftw dstftw closed this May 20, 2018
@dstftw dstftw added the incomplete label May 20, 2018
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
2 participants
You can’t perform that action at this time.