[FFmpeg-user] how to merge a video file with an audio file.

jd1008 jd1008 at gmail.com
Sat Aug 27 22:22:37 EEST 2016


I use youtube-dl as the download tool, as follows: (Please bear with me ...)

$ youtube-dl -F  https://www.youtube.com/watch?v=aNUYGRn3W9Q
[youtube] aNUYGRn3W9Q: Downloading webpage
[youtube] aNUYGRn3W9Q: Downloading video info webpage
[youtube] aNUYGRn3W9Q: Extracting video information
[youtube] aNUYGRn3W9Q: Downloading MPD manifest
[info] Available formats for aNUYGRn3W9Q:
format code  extension  resolution note
.
.
.
.

251          webm       audio only DASH audio  136k , opus @160k 
(48000Hz), 41.45MiB <<< The Audio file
.
.
.
.
.
248          webm       1920x1080  DASH video 7139k , vp9, 25fps, video 
only, 980.84MiB <<< The Video file
.
.
.
.
.
.

Youtube-dl uses ffmpeg to merge them as follows:

ffmpeg -y -i <video_file> -i <audio_file> -c copy -map 0:v:0 -map 1:a:0 
<output_file>

It fails to do the job in the following sense:
When I play the output file with mplayer, I only get audio,
and when I play it with vlc, I only get video, some of which is garbled.
When I play it with ffplay, only initial frames are garbled - but then
all plays well.

Both mplayer and vlc are latest.




More information about the ffmpeg-user mailing list