Showing posts with label video edit. Show all posts
Showing posts with label video edit. Show all posts

Sunday, February 11, 2024

Transcoding with intel quicksync (qsv) h264 -> hevc

Convert on hardware from h264 to h264 full hd, also compress audio to AAC to make a common .mp4 file.
#!/bin/env bash
# usage: enc.sh <source_file> <quality, e.g. 25, 1..51>
# https://trac.ffmpeg.org/wiki/Hardware/QuickSync
# accepts h264 and transcodes on hardware, tested.
ffmpeg -hwaccel qsv -c:v h264_qsv -i "$1" -init_hw_device qsv:hw -vf 'scale_qsv=1920:1080' -c:a aac -b:a 192K -c:v h264_qsv -global_quality:v $2 -preset:v 1 -profile:v 77 "$1-h264-aac-qsv-1080p-$2.mp4"
Convert to hevc/h265:
#!/bin/env bash
# usage: enc.sh <source_file> <quality, e.g. 25, 1..51>
# https://trac.ffmpeg.org/wiki/Hardware/QuickSync
# accepts h264 and transcodes on hardware, tested.
ffmpeg -hwaccel qsv -c:v h264_qsv -i "$1" -c:v hevc_qsv -global_quality:v $2 -preset:v 1 -profile:v 1 -c:a libopus -b:a 96K "$1-hevc-qsv-$2.mkv"
Encode to VP9 (in software):
#!/bin/env bash
# usage: enc.sh <source_file> <quality, e.g. 30, 0..63>
# https://trac.ffmpeg.org/wiki/Encode/VP9
ffmpeg -i "$1" -c:a libopus -b:a 96K -c:v libvpx-vp9 -b:v 0 -crf $2 -pass 1 -an -f null /dev/null
ffmpeg -i "$1" -c:a libopus -b:a 96K -c:v libvpx-vp9 -b:v 0 -crf $2 -pass 2 "`basename $1`_vp9tp_$2.webm"

Saturday, December 12, 2015

Blender frameserver and ffmpeg

 rm ffmpeg2*log*
date
echo starting blender
blender -b edr.blend -F FRAMESERVER -s 1 -e 300 --render-anim &
sleep 2
date
echo starting ffmpeg pass1
source "frameserver_pass1.sh"
sync
date
echo starting blender2
blender -b edr.blend -F FRAMESERVER -s 1 -e 300 --render-anim &
sleep 2
date
echo starting ffmpeg pass2
source "frameserver_pass2.sh"
sync
date
echo finished, going to sleep...

# systemctl suspend




-=-=-=-=-

BLENDER=http://localhost:8080
OUTPUT='-f null /dev/null'
CODEC_OPTS="-pix_fmt yuv420p -profile:v high -level 4.0 -vcodec libx264 -preset slow -b:v 12500k "
# -preset slow -profile:v high -level 4.0"
eval `wget ${BLENDER}/info.txt -O - 2>/dev/null |
    while read key val ; do
          echo R_$key=$val 
              done`
              i=$R_start
              {
                while [ $i -le $R_end ] ; do
                       wget ${BLENDER}/images/ppm/$i.ppm -O - 2>/dev/null
                              i=$(($i+1))
                                done
                                } | ffmpeg -vcodec ppm -f image2pipe -r $R_rate -i pipe:0 $CODEC_OPTS -pass 1 -threads 6 $OUTPUT
                                wget ${BLENDER}/close.txt -O - 2>/dev/null >/dev/null