options to trancode based on video size and frame rate

Issue #22 new
Helmy M created an issue

Is there an option to only transcode files if they are larger than a certain size, for example, there are many devices that can’t play 8K and some 4K videos, with a mixed collection of various video files that all are the same codec, container, how can it be configured to only transcode 4K videos

my current solution is the following transcode script

#!/bin/sh

#!/bin/sh

SOURCE=$1
STARTPOSITION=$2
DURATION=$3
if [[ $(ffprobe -v error -select_streams v:0 -show_entries stream=width -of csv=s=x:p=0 "$SOURCE")  -gt 3000 ]]
then
ffmpeg -ss $STARTPOSITION -t $DURATION -i "$SOURCE" -loglevel quiet -threads auto -async 2 -vf "fps=25,scale=3000:-1,format=yuv420p" -vcodec mpeg2video -b:v 50000k -f mpegts pipe:1
else
# need a way to skip transcoding entirely here
# -f mpegts , output format must be scpcified
# the output from this doesn't seek in VLC
ffmpeg -ss $STARTPOSITION -t $DURATION -i "$SOURCE" -loglevel quiet -threads auto -async 2  -vcodec copy -acodec copy -f mpegts pipe:1
fi

this works however it doesn’t seek in VLC even for files that don’t meet the width check

not returning anything in the transcode script doesn’t work, maybe a simple solution is adding a check if the transcode script doesn’t pipe anything to just behave normally and serve the file as is

Comments (1)

  1. Log in to comment