All pastes #4024153 Raw Edit

FFmpeg STDOUT routing error

public unlisted text v1 · immutable
#4024153 ·published 2018-05-09 22:18 UTC
rendered paste body

====START OF SCRIPT====

SOURCE=$1
DEBUG=yes
BACKUP_01=file.mp4
log=/tmp/log1
FILTER="-vf scale=-2:480"

if [ "$DEBUG" = yes ]; then
   FFOUT=">>$log 2>&1 </dev/null"
else
   FFOUT=">/dev/null 2>/dev/null </dev/null"
fi

ffmpeg -t 10 -i $SOURCE $FILTER -c:v libx264 -crf 30 -c:a libfdk_aac -profile:a aac_he -cutoff 18000 -ac 2 -b:a 64k $BACKUP_01 $FFOUT


====END OF SCRIPT====





Notice the quotes are only around a variableo with > or <.



=====SCRIPT RUNTIME====

$ bash -vx script.sh 21min.mpg
SOURCE=$1
+ SOURCE=21min.mpg
DEBUG=yes
+ DEBUG=yes
BACKUP_01=file.mp4
+ BACKUP_01=file.mp4
log=/tmp/log1
+ log=/tmp/log1
FILTER="-vf scale=-2:480"
+ FILTER='-vf scale=-2:480'


if [ "$DEBUG" = yes ]; then
   FFOUT=">>$log 2>&1 </dev/null"
else
   FFOUT=">/dev/null 2>/dev/null </dev/null"
fi
+ '[' yes = yes ']'
+ FFOUT='>>/tmp/log1 2>&1 </dev/null'


+ffmpeg -t 10 -i 21mins.mpg -vf scale=-2:480 -c:v libx264 -crf 30 -c:a libfdk_aac -profile:a aac_he -cutoff 18000 -ac 2 -b:a 64k file.mp4 '>>/tmp/log1' '2>&1' '</dev/null'



ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
  configuration: --enable-avfilter --enable-bzlib --enable-gpl --enable-libass --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-postproc --enable-pthreads --enable-runtime-cpudetect --enable-static --enable-swscale --enable-zlib --enable-libfreetype --enable-libfontconfig --enable-libfribidi --enable-libfdk-aac --enable-version3 --disable-decoder=libgsm --disable-encoder=libgsm --disable-doc --disable-shared --disable-ffserver --disable-ffplay --pkg-config-flags=--static --extra-ldflags=-static --extra-libs='-lx264 -ldl -lxvidcore -lmp3lame -lpthread -lm -lbz2 -lz -lpthread -lvpx -lass -lfontconfig -lexpat -lfreetype -lfribidi -lfaac -lx265 -lfdk-aac'
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mpegts, from '21mins.mpg':
  Duration: 00:21:47.36, start: 0.555556, bitrate: 10525 kb/s
  Program 1
    Stream #0:0[0x1e1]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(top first), 720x480 [SAR 1:1 DAR 3:2], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1e2](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
[NULL @ 0x35346e0] Unable to find a suitable output format for '>>/tmp/log1'
>>/tmp/log1: Invalid argument