Post-Processing with FFMPEG [Ubuntu shell script]
Posted: February 11th, 2016, 1:54 pm
SAB on Ubuntu 64.
I have a script that I use to change the container from MKV to MP4, remove subs, and convert audio to AC3. It does this using AVCONV (ffmpeg), and when finished deposits the new mp4 in a different directory. All of this works fine. However, when I call the script in SAB post-processing, it errors out. So what's going on? It looks like it is looking for a specific file called "*.mkv" instead of using "*" as a wildcard.
I chown/chmod as plex and sab and couchpotato use the same account...and want to ensure no permissions issues. Is there a better way, probably but I'm pushing the extent of my Linux abilities with this script as is... running manually this works well
calling from SAB post-processing..it errors out.
Thanks!!!
I have a script that I use to change the container from MKV to MP4, remove subs, and convert audio to AC3. It does this using AVCONV (ffmpeg), and when finished deposits the new mp4 in a different directory. All of this works fine. However, when I call the script in SAB post-processing, it errors out. So what's going on? It looks like it is looking for a specific file called "*.mkv" instead of using "*" as a wildcard.
I chown/chmod as plex and sab and couchpotato use the same account...and want to ensure no permissions issues. Is there a better way, probably but I'm pushing the extent of my Linux abilities with this script as is... running manually this works well
Code: Select all
#!/bin/sh
#Change .MKV container to .MP4 and convert audio to AC3
for f in /videos/movies/_pending/*.mkv; do avconv -i "$f" -format mp4 -vcodec copy -acodec ac3 -strict -2 -sn -threads 3 -movflags +faststart "${f%.*}.mp4";$.mp4"; done
mv /videos/movies/_pending/*.mp4 /videos/movies/incoming
mv /videos/movies/_pending/*.mkv /videos/movies/completed
chown -R plex:media /videos/movies/incoming
chmod -R 777 /videos/movies/incoming
exit
Code: Select all
ffmpeg version 1.0.10 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 25 2014 07:50:40 with gcc 4.7 (Debian 4.7.2-5)
configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libfdk-aac --enable-libdc1394 --disable-altivec --dis libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
/videos/movies/_pending/*.mkv: No such file or directory
mv: cannot stat ‘/videos/movies/_pending/*.mp4’: No such file or directory
mv: cannot stat ‘/videos/movies/_pending/*.mkv’: No such file or directory
chown: changing ownership of ‘/videos/movies/incoming’: Operation not permitted
chmod: changing permissions of ‘/videos/movies/incoming’: Operation not permitted