diff --git a/commands.yml b/commands.yml new file mode 100644 index 0000000..3c3255f --- /dev/null +++ b/commands.yml @@ -0,0 +1,18 @@ +--- + +- category: "H.264 Downsampling" + - name: "720p 4mpbs" + description: "This can be used as a catch all for most H.264 720p encodes, if you want a higher bitrate then modify the 4000k to your suit your needs" + command: | + ffmpeg -i "${INPUTFILE}" \ + -vf scale=-1:720 \ + -c:v h264 \ + -c:a copy \ + -b:v 4000k \ + "${OUTPUTFILE}" +- category: "H.265 Downsampling" +- category: "H.264 Downsampling Vaapi" +- category: "H.265 Downsampling Vaapi" +- category: "H.264 Downsampling Nvidia" +- category: "H.265 Downsampling Nvidia" +- category: "Audio Processing" diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..03aac09 --- /dev/null +++ b/config.yml @@ -0,0 +1,23 @@ +--- + +interval: 60 + +commands: + - name: "test1" + extension: ".mkv" + command: | + ffmpeg -i "${INPUTFILE}" \ + -vf scale=-1:720 \ + -c:v h264 \ + -c:a copy \ + -b:v 4000k \ + "${OUTPUTFILE}" + - name: "test2" + extension: ".mkv" + command: | + ffmpeg -i "${INPUTFILE}" \ + -vf scale=-1:720 \ + -c:v h264 \ + -c:a copy \ + -b:v 4000k \ + "${OUTPUTFILE}" \ No newline at end of file diff --git a/public/ffmpeg-web.js b/public/ffmpeg-web.js index 822f04f..a1a8916 100644 --- a/public/ffmpeg-web.js +++ b/public/ffmpeg-web.js @@ -9,24 +9,25 @@ $(document).ready(function(){rendermain()}) //// Main Page rendering //// function rendermain(){ + $('#pagecontent').empty(); $('#pagecontent').append('
'); socket.emit('getmain'); } socket.on('sendmain', function(rules){ $('#pagecontent').empty(); var editor = []; - $(JSON.parse(rules)).each(function(i,data){ + $(rules.commands).each(function(i,data){ var name = data.name; var extension = data.extension; var command = data.command; $('#pagecontent').append('\ -
\ -
\ - Process Rule ' + name + '\ -
\ +
\
\
\
\ +
\ + \ +
\
\ \
\ @@ -38,11 +39,8 @@ socket.on('sendmain', function(rules){ \
\
\ -
\ - \ -
\
\ - \ + \
\
\ \ @@ -59,12 +57,25 @@ socket.on('sendmain', function(rules){ editor[i].setOptions({ readOnly: false, }); - editor[i].setValue(data.command, -1); + editor[i].setValue(command, -1); }); }).promise().done(function(){ $('#pagecontent').append('
'); }); }); - - +//// Command Page rendering //// +function rendercommands(){ + $('#pagecontent').empty(); + $('#pagecontent').append('
'); + socket.emit('getcommands'); +} +socket.on('sendcommands', function(categories){ + console.log(categories); + $('#pagecontent').empty(); + var editor = []; + $('#pagecontent').append('
') + $(categories).each(function(i,data){ + var cat = data.category; + }); +}); diff --git a/public/index.html b/public/index.html index 6b0d564..0c4ced4 100644 --- a/public/index.html +++ b/public/index.html @@ -41,6 +41,15 @@ +
+ + +

diff --git a/requirements.txt b/requirements.txt index eaf43dd..c5d76eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ aiohttp python-socketio +pyyaml \ No newline at end of file diff --git a/root/etc/services.d/web/run b/root/etc/services.d/web/run index 7224b8d..267ba42 100644 --- a/root/etc/services.d/web/run +++ b/root/etc/services.d/web/run @@ -4,4 +4,4 @@ cd /app/ffmpeg-web exec \ s6-setuidgid abc nodemon \ - --exec python3 server.py > /applogs/app.log + --exec python3 server.py > /applogs/app.log 2>&1 diff --git a/server.py b/server.py index 81aff90..36a81aa 100644 --- a/server.py +++ b/server.py @@ -1,6 +1,7 @@ from aiohttp import web import socketio -import json +import yaml +import os sio = socketio.AsyncServer() app = web.Application() @@ -13,11 +14,25 @@ async def index(request): app.router.add_get('/', index) app.router.add_static('/public/', path=str('./public/')) -json = '[{"name":"test1","extension":".mkv","command":"ffmpeg -y -vaapi_device /dev/dri/renderD1339"},{"name":"test2","extension":".mkv","command":"ffmpeg -y -vaapi_device /dev/dri/renderD129"}]' - +# Send the current config to the user to render @sio.on('getmain') async def message(sid): - await sio.emit('sendmain', json, room=sid) + with open("./config.yml", 'r') as stream: + try: + config = yaml.safe_load(stream) + await sio.emit('sendmain', config, room=sid) + except yaml.YAMLError as e: + print(e) + +# Send the current command examples from github to the user to render +@sio.on('getcommands') +async def message(sid): + with open("./commands.yml", 'r') as stream: + try: + commands = yaml.safe_load(stream) + await sio.emit('sendcommands', commands, room=sid) + except yaml.YAMLError as e: + print(e) if __name__ == '__main__': web.run_app(app, port=8787)