posters for videos

master
Aevann1 2022-12-10 21:39:30 +02:00
parent 4439f03ef5
commit 02eb014dd8
3 changed files with 4 additions and 4 deletions

View File

@ -747,8 +747,8 @@ def submit_post(v:User, sub=None):
post.url = process_video(file, v)
name = f'/images/{time.time()}'.replace('.','') + '.webp'
subprocess.run(['ffmpeg', '-y', '-loglevel', 'warning',
'-i', post.url, '-vf', '"select=eq(n\,0)"', '-vf',
'scale=100:-2', '-q:v', '3', '-frames:v', '1', name], check=True)
'-i', post.url, '-vf', "scale='min(300,iw)':-2",
'-q:v', '3', '-frames:v', '1', name], check=True)
post.thumburl = name
elif file.content_type.startswith('audio/'):
post.url = process_audio(file, v)

View File

@ -143,7 +143,7 @@
<div class="row no-gutters mb-4">
<div class="col">
<p class="resizable bigger">
<video controls preload="none" src="{{p.realurl(v)}}"></video>
<video {% if p.thumb_url %}poster="{{p.thumb_url}}"{% endif %} controls preload="none" src="{{p.realurl(v)}}"></video>
</p>
</div>
</div>

View File

@ -248,7 +248,7 @@
{% elif p.is_video %}
<div id="video-{{p.id}}" class="ml-5 {% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
<p class="resizable bigger">
<video id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></video>
<video {% if p.thumb_url %}poster="{{p.thumb_url}}"{% endif %} id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></video>
</p>
</div>
{% elif p.is_audio %}