Bugfix
Bugfix

--- a/HLS-Stream-Creator.sh
+++ b/HLS-Stream-Creator.sh
@@ -167,6 +167,13 @@
 	  if ! kill -0 ${PIDS[$i]} 2> /dev/null
 	  then
 		echo "Encoding for bitrate ${BITRATE_PROCESSES[$i]}k completed"
+
+		if [ "$LIVE_STREAM" == "1" ] && [ `grep 'EXT-X-ENDLIST' "$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}_${BITRATE_PROCESSES[$i]}.m3u8" | wc -l ` == "0" ]
+		then
+		    # Correctly terminate the manifest. See HLS-15 for info on why
+		    echo "#EXT-X-ENDLIST" >> "$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}_${BITRATE_PROCESSES[$i]}.m3u8"
+		fi
+
 		unset BITRATE_PROCESSES[$i]
 		unset PIDS[$i]
 	  fi
@@ -300,7 +307,7 @@
       createVariantPlaylist "$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}_master.m3u8"
       for br in $OP_BITRATES
       do
-	    appendVariantPlaylistentry "$OUTPUT_DIRECTORY/${SEGMENT_DIRECTORY}${PLAYLIST_PREFIX}_master.m3u8" "${PLAYLIST_PREFIX}_${br}.m3u8" "$br"
+	    appendVariantPlaylistentry "$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}_master.m3u8" "${SEGMENT_DIRECTORY}${PLAYLIST_PREFIX}_${br}.m3u8" "$br"
       done
 
       OUTPUT_DIRECTORY+=$SEGMENT_DIRECTORY
@@ -308,7 +315,7 @@
       # Now for the longer running bit, transcode the video
       for br in $OP_BITRATES
       do
-	      BITRATE="-b:v ${br}k -bufsize ${br}k"
+	      BITRATE="-b:v ${br}k"
 	      # Finally, lets build the output filename format
 	      OUT_NAME="${SEGMENT_PREFIX}_${br}_%05d.ts"
 	      PLAYLIST_NAME="$OUTPUT_DIRECTORY/${PLAYLIST_PREFIX}_${br}.m3u8"

file:a/README.md -> file:b/README.md
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@
 	-t [name]	Segment filename prefix
 	-l		Input is a live stream
 	-f		Foreground encoding only (adaptive non-live streams only)
+	-S		Name of a subdirectory to put segments into
 ```