[FFmpeg-user] Stream multiple Videos as one single continuous stream

Keyran keyrans at gmail.com
Thu Aug 30 19:35:52 CEST 2012


Hi,

 We are building a solution where we want all the videos to be played one
after the another like a continuos stream. We are trying to build the
solution using ffmpeg for encoding/segmenting and apache tomcat server. The
way we are doing this is

   1. Each video is individually encoded to h264 and segmented in 10 sec
   interval. This generates playlist .m3u8 for each video.
   2. Whenever a set of videos (based on some criterion) needs to be
   streamed, we then manually create a playlist by concatenating each playlist
   file (while keeping the m3u8 format intact)

For example,
video A is split as A01.ts and A02.ts.
video B is split as B01.ts.

What we are trying to do is create one single playlist like the following.

#EXTM3U
#EXT-X-VERSION:4
#EXTINF:10.285189,
A01.ts
#EXTINF:9.285189,
A02.ts
#EXTINF:8.000189,
B01.ts
#EXT-X-TARGETDURATION:25
#EXT-X-ENDLIST

The problem that we are facing is that while this works in some cases, it
fails after playing 2 to 3 videos. If only one video was played, then we
would know that the solution is not possible. However since we know
at-least 2 videos play sometimes, we know we are missing something here.
Any help will be appreciated.

We are usng the following command to encode/segment the videos.

ffmpeg -v 9 -loglevel 99 -re -i video.MOV -an \
-c:v libx264 -b:v 128k \
-acodec libmp3lame -ar 48000 -ab 64k -vcodec libx264 -b 96k -flags +loop
-cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1
-refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor
0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp
0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 \
-flags -global_header -map 0 -f segment -segment_time 4 \
-segment_list test.m3u8 -segment_format mpegts stream%05d.ts


More information about the ffmpeg-user mailing list