2

I have two streams, one audio and the other video. I'm trying to combine them using this command:

ffmpeg -y -i audio.m3u8 -i video.m3u8 -c copy Video.mp4

I found this syntax here:

The m3u8 playlists are below.

The problem is that, while the audio in the resulting video is smooth and uninterrupted, the video is not. ffmpeg seems to have plucked only certain frames from each 5-second video segment and merged them with the corresponding audio segment. In the resulting video, each of these frames displays for exactly two seconds before moving on to the next one. There is no motion in the video.

I can play a given video segment and it works fine (just no audio). I've randomly tested a dozen or so of these.

How can I successfully merge all of these audio and video segments into an mp4 video?


Audio.m3u8

#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.059,
nova4806_r-hls-16x9-1080pAudio_2_00001.aac
#EXTINF:5.995,
nova4806_r-hls-16x9-1080pAudio_2_00002.aac
#EXTINF:6.016,
nova4806_r-hls-16x9-1080pAudio_2_00003.aac
#EXTINF:5.995,
nova4806_r-hls-16x9-1080pAudio_2_00004.aac
#EXTINF:6.016,
nova4806_r-hls-16x9-1080pAudio_2_00005.aac

...

#EXTINF:4.117,
nova4806_r-hls-16x9-1080pAudio_2_00532.aac
#EXT-X-ENDLIST

Video.m3u8

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-I-FRAMES-ONLY
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:2.002000,
#EXT-X-BYTERANGE:752@376
nova4806_r-hls-16x9-1080p-1080p-6500k_00001.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:71816@1983400
nova4806_r-hls-16x9-1080p-1080p-6500k_00001.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:44932@3277404
nova4806_r-hls-16x9-1080p-1080p-6500k_00001.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:111296@376
nova4806_r-hls-16x9-1080p-1080p-6500k_00002.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:89300@1748964
nova4806_r-hls-16x9-1080p-1080p-6500k_00002.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:124644@3753796
nova4806_r-hls-16x9-1080p-1080p-6500k_00002.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:107912@376
nova4806_r-hls-16x9-1080p-1080p-6500k_00003.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:83284@1639736
nova4806_r-hls-16x9-1080p-1080p-6500k_00003.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:198528@3142044
nova4806_r-hls-16x9-1080p-1080p-6500k_00003.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:95692@376
nova4806_r-hls-16x9-1080p-1080p-6500k_00004.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:119944@1713808
nova4806_r-hls-16x9-1080p-1080p-6500k_00004.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:167320@3345460
nova4806_r-hls-16x9-1080p-1080p-6500k_00004.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:146452@376
nova4806_r-hls-16x9-1080p-1080p-6500k_00005.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:172020@1739000
nova4806_r-hls-16x9-1080p-1080p-6500k_00005.ts
#EXTINF:2.002000,
#EXT-X-BYTERANGE:135548@3396032
nova4806_r-hls-16x9-1080p-1080p-6500k_00005.ts

...

#EXTINF:0.100100,
#EXT-X-BYTERANGE:564@3384376
nova4806_r-hls-16x9-1080p-1080p-6500k_00532.ts
#EXT-X-ENDLIST

Master.m3u8

#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-VERSION:4
#EXT-X-MEDIA:URI="nova4806_r-hls-16x9-1080pAudio%20Selector%201.m3u8",TYPE=AUDIO,GROUP-ID="multiple_audio_tracks",LANGUAGE="eng",NAME="English",DEFAULT=YES,AUTOSELECT=YES
#EXT-X-MEDIA:URI="nova4806_r-captions.m3u8",TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="en",NAME="English",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,CHARACTERISTICS="public.accessibility.describes-music-and-sound,public.accessibility.transcribes-spoken-dialog"
#EXT-X-MEDIA:URI="nova4806_r-hls-16x9-1080pAudio%20Selector%202.m3u8",TYPE=AUDIO,GROUP-ID="multiple_audio_tracks",LANGUAGE="eng",NAME="English AD",DEFAULT=NO,AUTOSELECT=YES,CHARACTERISTICS="public.accessibility.describes-video"
#EXT-X-STREAM-INF:BANDWIDTH=2629077,AVERAGE-BANDWIDTH=2265370,RESOLUTION=960x540,CODECS="avc1.64001f,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-540p-2000k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=7966199,AVERAGE-BANDWIDTH=6905882,RESOLUTION=1920x1080,CODECS="avc1.640028,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-1080p-6500k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=5471302,AVERAGE-BANDWIDTH=4841216,RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-720p-4500k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3909956,AVERAGE-BANDWIDTH=3298061,RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-720p-3000k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1583840,AVERAGE-BANDWIDTH=1338316,RESOLUTION=768x432,CODECS="avc1.64001e,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-432p-1100k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1108550,AVERAGE-BANDWIDTH=957278,RESOLUTION=640x360,CODECS="avc1.64001e,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-360p-730k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=624245,AVERAGE-BANDWIDTH=565523,RESOLUTION=480x270,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-270p-365k.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=360807,AVERAGE-BANDWIDTH=334708,RESOLUTION=416x234,CODECS="avc1.4d400c,mp4a.40.2",AUDIO="multiple_audio_tracks",SUBTITLES="subs"
nova4806_r-hls-16x9-1080p-234p-145k.m3u8
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1030462,RESOLUTION=960x540,CODECS="avc1.64001f",URI="nova4806_r-hls-16x9-1080p-540p-2000k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=3127072,RESOLUTION=1920x1080,CODECS="avc1.640028",URI="nova4806_r-hls-16x9-1080p-1080p-6500k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1349242,RESOLUTION=1280x720,CODECS="avc1.64001f",URI="nova4806_r-hls-16x9-1080p-720p-4500k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=1343232,RESOLUTION=1280x720,CODECS="avc1.64001f",URI="nova4806_r-hls-16x9-1080p-720p-3000k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=630297,RESOLUTION=768x432,CODECS="avc1.64001e",URI="nova4806_r-hls-16x9-1080p-432p-1100k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=436976,RESOLUTION=640x360,CODECS="avc1.64001e",URI="nova4806_r-hls-16x9-1080p-360p-730k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=215984,RESOLUTION=480x270,CODECS="avc1.4d4015",URI="nova4806_r-hls-16x9-1080p-270p-365k_I-Frame.m3u8"
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=96159,RESOLUTION=416x234,CODECS="avc1.4d400c",URI="nova4806_r-hls-16x9-1080p-234p-145k_I-Frame.m3u8"

1 Answer 1

1

I've got same problem yesterday. Solution is first convert them separately to mp4 files and merge audio.mp4 and video.mp4 into one file afterwards.

1
  • Thanks, I'll give that a try next time I run into this. Given that it's been two and a half years, these particular files are long gone from memory, but I'll keep your advice in mind for the future.
    – InteXX
    Commented Jan 14 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.