Question

I have multiple mp4 streams that I take and convert into mpeg-2 ts format using ffmpeg

ffmpeg -i 0.mp4 -vcodec libx264 -sameq -acodec libfaac -fflags +genpts -coder 0 -f mpegts 0.ts

The mp4s range from 1 to n. After converting all of them, I create a manifest file similar to:

#EXTM3U
#EXT-X-TARGETDURATION:4
#EXT-X-VERSION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:EVENT
#EXTINF:4.000,
http://localhost/Nick2/0.ts
#EXT-X-DISCONTINUITY
#EXTINF:3.97,
http://localhost/Nick2/1.ts
#EXT-X-DISCONTINUITY
#EXTINF:3.97,
http://localhost/Nick2/2.ts
#EXT-X-DISCONTINUITY
#EXTINF:3.97,
http://localhost/Nick2/3.ts
#EXT-X-DISCONTINUITY
#EXTINF:3.97,
http://localhost/Nick2/4.ts
#EXT-X-ENDLIST

I've added the #EXT-X-DISCONTINUITY since the I'm trying to get back to back playback of the converted mp4's. The problem is that if I try to use HTTP live streaming, there is a noticeable pop in the audio between files. But that isn't apparent if playing the segments in QT. Any thoughts on how I can fix this?

Was it helpful?

Solution

The gap or pop between the segments is caused by the decoder being reset. That's basically what the #EXT-X-DISCONTINUITY tag is for.

You can remove the discontinuities making the stream on the same timeline. This would require you to concatenate the source files, and then encode and segment the output. Here is some documentation on concatenation: http://www.ffmpeg.org/faq.html#How-can-I-concatenate-video-files_003f

OTHER TIPS

So, since I wanted to do Http live streaming, I concataned the files and then split them again, which made the audio pops go away. Though the apple media stream validater still barfs, things seem to work well...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top