Video

Reducing RTMPT disconnects on RED5

RED5RTMPT streams provided by RED5 are notorious for randomly disconnecting.

Chris Georgoulis and I extensively debugged this for a project and were able to reduce the disconnection rate from 90% to 40% for connections that lasted over 5 minutes. This was for a teleconferencing application that required 4 RTMPT streams in total (2 outgoing, 2 incoming) with a maximum buffer of 200ms.

RED5 by default has a maximum of 100 keep-alive requests. On the 100th request the server returns connection-close . By setting the limit to infinite we were able to improve the performance. RTMPT is quite vulnerable to disconnections and closing and reopening the socket connection plays a role.

As described by Chris, please go to /{red5_folder}/conf/jee-container.xml and modify the following element group with the extra <property> tags(this should be at line 21), and then restart red5:

More

Combine FLV/MP4 Videos Together

Hey, a quick post about a script I wrote for combining together multiple video files.
It’s based on a post from: http://www.webupd8.org/2009/05/join-and-split-files-including-video-in.html

 

Steps during execution

1) The script converts all mp4 and flv files to MPG files.

2) This is done in order to use the CAT command with > to send all the bytes from all files into one location output.mpg.

3) Finally we convert output.mpg  to MP4 and have the final file.

NOTE: I will check into using possible shortcuts to speed up the process.

#!/bin/bash
echo
echo
echo Combine Videos Together
echo based on http://www.webupd8.org/2009/05/join-and-split-files-including-video-in.html
echo ----------------------------------------------------------
sleep 3
for i in *.mp4; do
 if [ -e "$i" ]; then
   file=`basename "$i" .mp4`
   echo converting "$i" to "$file.mpg"
   ffmpeg -i "$i" -sameq "$file.mpg"
 fi
done

for i in *.flv; do
 if [ -e “$i” ]; then
   file=`basename “$i” .flv`
   echo converting “$i” to “$file.mpg”
   ffmpeg -i “$i” -sameq “$file.mpg”
 fi
done

mkdir temp
mv *.mpg temp
cd temp
cat * > output.mpg
ffmpeg -i output.mpg -sameq final.mp4