В общем решил пойти другим путем, воспроизводить видео через браузер, и отпала надобность перезагружать vlc для перезагрузки видео.
<!DOCTYPE html>
<html lang="ru">
<head>
<script src="https://code.jquery.com/jquery-1.11.0.min.js" integrity="sha256-spTpc4lvj4dOkKjrGokIrHkJgNA0xMS98Pw9N7ir9oI=" crossorigin="anonymous"></script>
<meta charset="utf-8" />
</head>
<body style="overflow: hidden; background-color: black;">
<iframe id="barCode" style="z-index: -1; position: absolute; border: none; left: 0; top: 0; width: 100%; height: 100%;">
</iframe>
<img id="default" src="default.png" style="position: absolute; z-index: 5; top: 0; left:0;"/>
<img id="playImage" src="" style="position: absolute; z-index: -1; top: 0; left:0;"/>
<iframe id="url" style="z-index: -1; position: absolute; top: 0; left: 0; border: 0; width: 100%; height: 100%;">
</iframe>
<video id="VideoPlayer" style="position: absolute; width: 100%; height: 100%; z-index: -1; top: 0; left: 0;" autoplay="autoplay" poster="">
<source src="">
</video>
</body>
<script>
$(function() {
var interval = 0;
var video = $("#VideoPlayer");
var source = video.find("source");
var image = $("#playImage");
var def = $("#default");
var url = $("#url");
image.css("width", "100%");
image.css("height", "100%");
var timer = {
name: 0,
time: 0,
run: function(timer) {
if (timer.time >= 30) {
timer.userOmission(timer);
} else {
timer.time += 1;
timer.name = setTimeout(function() {timer.run(timer);}, 1000);
}
},
clear: function(timer) {
timer.time = 0;
},
stop: function(timer) {
clearTimeout(timer.name);
timer.clear(timer);
},
userOmission: function(timer) {
timer.stop(timer);
$("#barCode").css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
}
};
function getBarCode() {
$.ajax({
url: "/slot?barcode",
headers: {
'If-None-Match' : (!localStorage['Etag']) ? "" : localStorage['Etag'],
'If-Modified-Since' : (!localStorage['Last-Modified']) ? "" : localStorage['Last-Modified']
},
success: function(data, s, xhr) {
clearInterval(interval);
service_url = "http://{bar_code}/";
$("#barCode").attr("src", service_url.replace("{bar_code}", data));
$("#barCode").css({"zIndex" : "5", "visibility" : "visible", "display" : "block"});
def.css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
url.css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
image.css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
video.css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
completeGetBarCode(xhr);
},
error: function(data) {
setTimeout(function() {completeGetBarCode(data);}, 15000);
},
timeout: 20000
});
function completeGetBarCode(xhr) {
if ((xhr.getResponseHeader('Etag') != null) || (xhr.getResponseHeader('Last-Modified') != null)) {
localStorage['Etag'] = xhr.getResponseHeader('Etag');
localStorage['Last-Modified'] = xhr.getResponseHeader('Last-Modified');
}
getBarCode();
}
}
function downloadPlayList(playlist, item)
{
$.ajax({
type: "GET",
url: "http://localhost/DS/html/media/playlist.json", <!--загружаем playlist в формате .json его нужно предварительно сгенерировать [[,["video1","1","duration-in-mil-sec"],["video2","1","30038"],["video3","1","77459"]],[]] -->
success: function(data)
{
setTimeout(displayPlayListItem, 0, data, item);
},
error: function()
{
setTimeout(displayPlayListItem, 0, playlist, item);
}
});
}
function displayPlayListItem(playlist, item)
{
var time = 10000;
var images = playlist[0];
if (images.length != 0)
{
if (item >= images.length)
{
item = 0;
}
if (images[item][1] == "1") { // video
def.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
url.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
image.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
video.css({"zIndex": "5", "visibility": "visible", "display": "block"});
source.attr("src", "http://localhost/DS/html/files/" + images[item][0]); <!-- файлы в кодировке h264 -->
video[0].load();
video[0].play();
} else if (images[item][1] == "0") { // image
def.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
url.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
image.css({"zIndex": "5", "visibility": "visible", "display": "block"});
video.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
source.attr("src", "");
image.attr("src", "http://localhost/DS/html/files/" + images[item][0]);
} else if (images[item][1] == "2") { // url
def.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
url.css({"zIndex": "5", "visibility": "visible", "display": "block"});
image.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
video.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
source.attr("src", "");
url.attr("src", images[item][0]);
} else if (images[item][1] == "3") { // audio
def.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
url.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
image.css({"zIndex": "-1", "visibility": "hidden", "display": "none"});
video.css({"zIndex": "5", "visibility": "visible", "display": "block"});
video.attr("poster", "");
source.attr("src", "http://localhost/DS/html/files/" + images[item][0]);
video[0].load();
video[0].play();
}
time = images[item][2];
++item;
}
else
{
def.css({"zIndex" : "5", "visibility" : "visible", "display" : "block"});
image.css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
video.css({"zIndex" : "-1", "visibility" : "hidden", "display" : "none"});
}
setTimeout(downloadPlayList, time, playlist, item);
}
downloadPlayList([[]], 0);
getBarCode();
$("#barCode").live("click", function() {
console.log(timer);
timer.clear(timer);
});
});
</script>
</html>
И bash скрипт для конвертации и генерации файла playlist.json
#!/bin/bash
LOCK_FILE=/home/gv/Video/lockfile.lock
if [ -e $LOCK_FILE ]
then
PID=`cat $LOCK_FILE`
PID_NAME=`ps -p $PID -o comm=`
if [ ! -z $PID_NAME ]
then
echo $(date -u)"Скрипт $0 найден в списке прооцессов";
exit -1;
else
echo $(date -u)"Обнаружен lock-file с несуществующим ID процесса"
rm $LOCK_FILE
fi
fi
echo $$ > $LOCK_FILE
sleep 5m
ipofclient=10.10.10.10;
sshpass=password
folderhtml=/temp/folder/to/upload #temp
foldervideoonthinclient=/folder/in/thinclient/with/file
loginandhostname=login@$ipofclient #данные для ssh
dir=/folder/to/upload/new/video;
a=/folder/in/thinclient/with/file;
Normaltimetmp=/folder/withtemp/file
jsonfile=/pathto/playlist.json
filewhithlistofvideo=/files/withlist/of/video
sshpass -p ds ssh -o StrictHostKeyChecking=no login@$ipofclient "rm -R $foldervideoonthinclient/*"
mkdir $a;
chmod 0777 $a;
cp -rp $dir/* $a/;
sleep 10
find $a -type f | while read full
do
name=${full##*/}
mv -- "${full}" "${full%/*}/${name// /_}"
done;
cd $a;
for video in `find . -type f`;
do mv "$video" $(echo "$video" | sha1sum | cut -f1 -d' ');
done;
find $a -type f | while read video; do
name=${video##*/}
#Простой рабочий вариант ffmpeg -i "$video" -vcodec libx264 $video.mp4 < /dev/null;
ffmpeg -i "$video" -c:v libx264 -crf 23 -preset ultrafast -movflags +faststart -vf scale=-2:720 $video.mp4 < /dev/null;
#-crf 20.0 -vcodec libx264 -vf scale=w=1280:h=720 -preset slow -acodec aac -strict experimental -ar 48000 -b:a 128k -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq #6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0
#rm -r ${video}
done;
cd $a;
#find -name "*[^\.]*" --delete;
for i in *; do mv $i $(echo $i | sed 's/\.[a-zA-Z1-9]*$//');
done;
videotmp=`ls $a >> $filewhithlistofvideo` #Записываем список преобразованных файлов в файл
declare -a array1
array1=(`cat $filewhithlistofvideo | tr '\n' ' '`) #Записываем в массив все строчки из файла с видео
declare -a array2
array2=(`for f in $a/*; do
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $f
done`) # записываем в массив данные о продолжительности видео
shtuka=1000
p="${array2[0]} $shtuka * p" |dc | sed 's/.\{7\}$//'
for math in ${array2[0]} ${array2[1]} ${array2[2]} ${array2[3]} ${array2[4]} ${array2[5]} ${array2[6]} ${array2[7]} ${array2[8]} ${array2[9]} ${array2[10]} ${array2[11]} ${array2[12]} ${array2[13]} ${array2[14]} ${array2[15]} ${array2[16]} ${array2[17]} ${array2[18]} ${array2[19]} ${array2[20]} ${array2[21]} ${array2[22]} ${array2[23]} ${array2[24]} ${array2[25]} ${array2[26]} ${array2[27]} ${array2[28]} ${array2[29]} ${array2[30]} ${array2[31]}
do
echo "$math $shtuka * p" |dc | sed 's/.\{7\}$//' >> $Normaltimetmp
done
array3=(`cat $Normaltimetmp | tr '\n' ' '`)
echo '[''[''[''"'${array1[0]}'"'',''"1"'',''"'${array3[0]}'"'']'',''[''"'${array1[1]}'"'',''"1"'',''"'${array3[1]}'"'']'',''[''"'${array1[2]}'"'',''"1"'',''"'${array3[2]}'"'']'',''[''"'${array1[3]}'"'',''"1"'',''"'${array3[3]}'"'']'',''[''"'${array1[4]}'"'',''"1"'',''"'${array3[4]}'"'']'',''[''"'${array1[5]}'"'',''"1"'',''"'${array3[5]}'"'']'',''[''"'${array1[6]}'"'',''"1"'',''"'${array3[6]}'"'']'',''[''"'${array1[7]}'"'',''"1"'',''"'${array3[7]}'"'']'',''[''"'${array1[8]}'"'',''"1"'',''"'${array3[8]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[10]}'"'',''"1"'',''"'${array3[10]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[11]}'"'']'',''[''"'${array1[11]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[12]}'"'',''"1"'',''"'${array3[12]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[13]}'"'']'',''[''"'${array1[13]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[14]}'"'',''"1"'',''"'${array3[14]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[15]}'"'']'',''[''"'${array1[15]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[16]}'"'',''"1"'',''"'${array3[16]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[17]}'"'']'',''[''"'${array1[17]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[18]}'"'',''"1"'',''"'${array3[18]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[19]}'"'']'',''[''"'${array1[19]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[20]}'"'',''"1"'',''"'${array3[20]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[21]}'"'']'',''[''"'${array1[21]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[22]}'"'',''"1"'',''"'${array3[22]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[23]}'"'']'',''[''"'${array1[23]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[24]}'"'',''"1"'',''"'${array3[24]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[25]}'"'']'',''[''"'${array1[25]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[26]}'"'',''"1"'',''"'${array3[26]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[27]}'"'']'',''[''"'${array1[27]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[28]}'"'',''"1"'',''"'${array3[28]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[29]}'"'']'',''[''"'${array1[29]}'"'',''"1"'',''"'${array3[9]}'"'']'',''[''"'${array1[30]}'"'',''"1"'',''"'${array3[30]}'"'']'',''[''"'${array1[9]}'"'',''"1"'',''"'${array3[31]}'"'']'',''[''"'${array1[31]}'"'',''"1"'',''"'${array3[9]}'"'']'',''],''['']'']' > $jsonfile
#Не забудь удалить файлы иначе задваиваются значения в JSON rm
#Передаем файлы
sed -r 's/\["","1",""\],? *//g; s/,\]/]/g' -i $jsonfile
sshpass -p $sshpass scp -r $folderhtml $loginandhostname:$foldervideoonthinclient
#sshpass -p $sshpass ssh -o StrictHostKeyChecking=no $loginandhostname reboot// Не работает ребует рута на вертуалке
#Удаляем всякий темп
rm -f $filewhithlistofvideo
rm -f $Normaltimetmp
rm -f $jsonfile
rm -f $a/*
rm $LOCK_FILE
exit 0