Sponsored Content
Top Forums Shell Programming and Scripting Script to reencode all files in a directory Post 303040332 by colt on Saturday 26th of October 2019 05:49:16 PM
Old 10-26-2019
Script to reencode all files in a directory

Hello. I usually reencode many video files with this ffmpeg command or similar

Code:
ffmpeg -y -i -c:a copy -vf scale=720:-2 -c:v mpeg4 -vtag xvid -b:v 969k -r 25 -pass 1 -an -f avi /dev/null && ffmpeg -i  -c:a libmp3lame -b:a 48k -ac 1 -vf scale=720:-2,subtitles=1.srt:force_style='Fontsize=20' -c:v mpeg4 -vtag xvid -b:v 969k -r 25 -pass 2 /.avi

So I would like to insert the parameters of this ffmpeg command on a script that reencodes all the videos on a certain directory. I tried to adapt a script that I found for it

Code:
for f in $(find -type f -name *.mkv); do ffmpeg -n -y -i "$f.mkv" -vf scale=720:-2 -c:v mpeg4 -vtag xvid -b:v 969k -r 25 -pass 1 -an -f avi /dev/null && ffmpeg -n -i "$f" -c:a libmp3lame -b:a 48k -ac 1 -vf scale=720:-2,subtitles="$f.srt":force_style='Fontsize=20' -c:v mpeg4 -vtag xvid -b:v 969k -r 25 -pass 2  ".$f.avi" ; done

However, when I try to run this script. it says that cannot find such file or directory. This happens because its treating every word separated by a blank space of the file's name as a file on its own.

So how can I solve this question. Also warns about any possible errors that might arise are welcome. Thank you
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Go Thru Files in a directory:Script

Hi, I am new to unix scripting and I need to write a script that accepts a directory name as an argument, and inside the script to go through all the ".dat" files in that directory. For each ".dat" file in the directory, create a control file(.ctl) file containing the associated ".dat" file name... (0 Replies)
Discussion started by: Axis99
0 Replies

2. Shell Programming and Scripting

script to count files in a directory

Hello, I was wondering if anyone had an answer for this? thanks, KW (3 Replies)
Discussion started by: kwa71
3 Replies

3. Shell Programming and Scripting

How to execute script on files in another directory?

Hi Guys, Is there any way I can execute my bash script on files in a different folder than what the script is in? Here is an excerpt of my script: #!/usr/bin/bash input_path="/cygdrive/c/files" output_path="/cygdrive/c/files/data" #script uses files from /cygdrive/c/files directory,... (1 Reply)
Discussion started by: npatwardhan
1 Replies

4. UNIX for Dummies Questions & Answers

Reading files in script from another directory

Hi I'm trying to call my files from different directories in my script. Can you please help me. Here is my script: #!/bin/bash #---------------------------------------------------------------------------------------------------------------------- #This script allows the user... (1 Reply)
Discussion started by: ladyAnne
1 Replies

5. Shell Programming and Scripting

Script which removes files from the first directory if there is a file in the second directory

Script must removes files from the first directory if there is a file with same name in the second directory Script passed to the two directories, it lies with them in one directory: sh script_name dir1 dir2 This is my version, but it does not work :wall: set - $2/* for i do set -... (6 Replies)
Discussion started by: SLAMUL
6 Replies

6. Shell Programming and Scripting

How to check whether directory has files in it or not in shell script?

hi, I am having script in which i want to check if directory has any file in it or not. If directory contains a single or more files then and only then it should proceed to further operations... P.S.: Directory might have thousand number of files. so there might be chance of getting error... (4 Replies)
Discussion started by: VSom007
4 Replies

7. UNIX for Dummies Questions & Answers

Script to remove zip files from a directory

Hi Folks, There is a job which generates a .zip files every day at /usr/app/generated directory , now please advise for the script that will delete this zip files permanently.but while deleting it should make sure that it will not delete the last two days recently generated zip files and this... (1 Reply)
Discussion started by: punpun66
1 Replies

8. Shell Programming and Scripting

Moving Files one directory to another directory shell script

Hi, Could you please assist how to move the gz files which are older than the 90 days from one folder to another folder ,before that it need to check the file system named "nfs" if size is less than 90 or not. If size is above 90 then it shouldn't perform file move and exit the script throwing... (4 Replies)
Discussion started by: venkat918
4 Replies

9. Shell Programming and Scripting

Script to keep checking the directory for files.

Hello Folks, Looking for a script which can keep doing ls to the directories and once file landed to the directory then ,read the files do further calculation and exit. Kindly guide. Regards, Sadique (3 Replies)
Discussion started by: sadique.manzar
3 Replies
transcode(export)						 3th February 2008						 transcode(export)

NAME
transcode - export modules collection SYNOPSIS
transcode -y module[,module[,module]] [other options] COPYRIGHT
transcode is Copyright (C) 2001-2003 by Thomas Oestreich, 2003-2004 Tilmann Bitterberg, 2004-2010 Transcode Team ENCODER PARAMETERS STRING
Module-dependent parameters can be passed to encoder using the -F transcode(1) option: transcode -F codec_string Those parameters tune the general behaviour of the export module. More specific settings can fine-tune the export settings. Those settings are passed to export modules through module options or through the module configuration file; both configuration file and options can be present at same time: in that case, the options overrides the configuration file. Passing option strings to export modules is done like to pass options to filter modules: The syntax is: transcode -y vmod=options,amod=options see transcode_filter(1) for full reference and examples. The -F parameter has different meanings for different export modules, as documented on section below. ENCODER MODULES PARAMETERS
ffmpeg: The codec String for the codec you want to encode. Example values are -F mpeg4 or -F mpeg1video or -F huffyuv. To get a list of valid codecs, use -F list im: The name of the image format you want to export. Example values are '-F jpg' (default) or '-F png' or -F 'gif'. With -F jpg, -w gives quality in percent. With -F png, the first digit of -w gives compression level, the second one gives quality, so -w 95 selects best compression level (9) and 5 means PNG adaptive filtering. jpg: The quality of the JPEG encode in percent. Example values are '-F 75' (default) or '-F 100' mov: Syntax: -F "<vcodec>,<acodec>[,<parameters>]" <vcodec> = Videocodec to encode with. Default: "mjpa" <acodec> = Audiocodec to encode with. Default: "ima4" <parameters> = A comma seperated list of parameters to be passed to the codec. Note: You can use "list" instead of a video/audiocodec or parameter to get a list of supported options. mpeg: Syntax: -F "<base-profile>[,<resizer-mode>[,user-profile]]" <base-profile> can be one of '1' = MPEG 1 (default) 'b' = big MPEG 1 (experimental) 'v' = VCD 's' = SVCD '2' = MPEG2 'd' = DVD compliant <resizer-mode> can be one of 0 = disable resizer (default) 1 = 352x288 2 = 480x480 3 = 480x576 4 = 352x240 <user-profile> is a filename of the profile file. You can either specify the absolute path to the file or if you transcode will look for it in the directory where you started transcode. mpeg2enc: Syntax: -F "<base-profile>[,<options_string>]" <base-profile> can be one of '0' = Generic MPEG1 (default) '1' = Standard VCD '2' = User VCD '3' = Generic MPEG2 '4' = Standard SVCD '5' = User SVCD '6' = Manual parameter mode '8' = DVD <options_string> will be passed down to mpeg2enc untouched by transcode. Have a look at the manpage for mpeg2enc. raw: The name of the image format to use for uncompressed video. Examples are I420 (YUV 4:2:0 planar), YV12 (the same thing with U and V reversed), or UYVY (YUV 4:2:2 packed). Use "-F help" to get a list of formats. EXPORT MODULES
If no module is specified through the -y option, transcode will use the null module for both audio and video export. If a multiplex module is given, by giving three export module names instead the usual two, transcode will use the new-style encode/multiplex modules (still under development, see the encode and multiplex directories); if no multiplex module is given, the traditional export modules will be used. To see what export modules are avalaible for your transcode installation, do a ls -1 $( tcmodinfo -p )/export*.so A complete transcode installation has the following export modules: ac3 - (video) null | (audio) ac3 This module has no compile-time dependencies. At run-time ffmpeg must be present. Support for this module is good. Encodes audio (raw PCM) to AC3 via the ffmpeg binary. Supported processing formats: audio - PCM, video - none af6 - (video) Win32 dll | (audio) MPEG/AC3/PCM At compile-time libavifile must be available. At run-time libavifile and win32codecs must be present. Support for this module is good. Interface to the avifile library which allows the use of win32codec on the linux-x86 platform. Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RGB YUV divx5 - (video) DivX 5.xx | (audio) MPEG/AC3/PCM At compile-time libmp3lame (only for MPEG audio layer III) must be available. At run-time divx4linux (new) and libdivxencore.so must be present. Support for this module is good. Encodes MPEG4 video using the closed-source binaries from divx.com to an AVI container. Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RGB YUV dv - (video) Digital Video | (audio) MPEG/AC3/PCM At compile-time libdv and libmp3lame (only for MPEG audio layer III) must be available. At run-time libdv must be present. Support for this module is good. Encodes DV into an AVI container. DV is a codec developed by Sony and is often used in digital camcorders. Supported processing formats: audio - PCM AC3, video - RGB YUV dvraw - (video) Digital Video | (audio) PCM At compile-time libdv must be available. At run-time libdv must be present. Support for this module is good. Encodes DV into a DV file. DV is a codec developed by Sony and is often used in digital camcorders. A raw DV file can be played back into the camcorder. Supported processing formats: audio - PCM, video - RAW (pass-through) RGB YUV YUV422 ffmpeg - (video) * | (audio) MPEG/AC3/PCM At compile-time libmp3lame (only for MPEG audio layer III) must be available. This module has no run-time dependencies. Sup- port for this module is good. Encodes many different formats to both AVI and raw. Supported are mpeg1video, mpeg2video, mpeg4, mjpeg, h263, h263p, wmv1, wmv2, rv10, msmpeg4, msmpeg4v2, huffyuv and dvvideo. Supported processing formats: audio RAW (pass-through) PCM AC3, video - RGB YUV YUV422 im - (video) * | (audio) MPEG/AC3/PCM At compile-time libImageMagick must be available. This module has no run-time dependencies. Support for this module is good. Encodes image sequences by using the ImageMagick library. ImageMagick is able to handle a lot of different image formats such as png, jpg, miff, tiff, etc. Use -F to select the desired format. Supported processing formats: audio - RAW (pass-through) PCM, video - RGB YUV jpg - (video) * | (audio) MPEG/AC3/PCM At compile-time libjpeg must be available. This module has no run-time dependencies. Support for this module is good. Encodes jpg image sequences using libjpeg. Faster than ImageMagick. Use -F to select the compression quality. Supported processing formats: audio - RAW (pass-through) PCM, video - RGB YUV lame - (audio) MPEG 1/2 At compile-time libmp3lame (only for MPEG audio layer III) must be available. At run-time lame and sox must be present. Sup- port for this module is good. An audio-only encoder which drives the lame binary. The tool sox is used to do resampling if required. Encodes to a MP3 file. Supported processing formats: audio - PCM, video - none lzo - (video) LZO real-time compression | (audio) MPEG/AC3/PCM At compile-time liblzo and libmp3lame (only for MPEG audio layer III) must be available. This module has no run-time dependen- cies. Support for this module is good. Encodes video using a loss-less real-time LZO codec. This codec is a homegrown invention of transcode and is intended as an intermediate storage format. MPlayer can playback LZO-based AVI files as well. Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RAW (pass-through) RGB YUV DV mov - (video) * | (audio) * At compile-time libquicktime must be available. At run-time libquicktime must be present. Support for this module is fair. Interface to the quicktime library. Supported processing formats: audio - PCM, video - RAW (pass-through) RGB YUV YUV422 YUY2 mp2 - (video) null | (audio) MPEG 1/2 This module has no compile-time dependencies. At run-time ffmpeg and sox must be present. Support for this module is good. Encodes audio (raw PCM) to MPEG 1 Layer 2 audio aka mp2. Additionaly it can change the speed of the audio stream by a factor you can specify. See docs/export_mp2.txt. Supported processing formats: audio - PCM, video - none mp2enc - (audio) MPEG 1/2 At compile-time mjpegtools must be available. At run-time mp2enc must be present. Support for this module is good. Drives the mp2enc binary and writes an MP2 (MPEG1-Layer2) file. Useful for when encoding to SVCD to be multiplexed with mplex after encoding. Supported processing formats: audio - PCM, video - none mpeg2enc - (video) MPEG 1/2 At compile-time mjpegtools must be available. At run-time mpeg2enc must be present. Support for this module is good. Drives the mpeg2enc binary. mpeg2enc is a very feature rich MPEG encoder, have a look at its manpage. Encodes generic mpeg1, VCD, SVCD, MPEG2 and DVD type video. Supported processing formats: audio - none, video - RGB YUV null - (video) null | (audio) null This module has no compile-time dependencies. This module has no run-time dependencies. Support for this module is good. Data sink. Does nothing else than discarding data. Supported processing formats: audio - none, video - none ogg - (video) null | (audio) ogg This module has no compile-time dependencies. At run-time oggenc must be present. Support for this module is good. Drives the oggenc binary. Encodes an Ogg/Vorbis file. Resamples. Supported processing formats: audio - PCM, video - none ppm - (video) PPM/PGM | (audio) MPEG/AC3/PCM This module has no compile-time dependencies. This module has no run-time dependencies. Support for this module is good. Writes an image sequence of PGM or PPM files. PPM is an old format and there are several tools around to manipulate such files. Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RGB YUV pvm - (video) * | (audio) * At compile-time libpvm3 must be available. At run-time pvm must be present. Support for this module is good. Meta module. It allows transcode to be used in a PVM cluster. See docs/export_pvm.txt Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RAW (pass-through) RGB YUV DV YUV422 YUY2 raw - (video) * | (audio) MPEG/AC3/PCM This module has no compile-time dependencies. This module has no run-time dependencies. Support for this module is good. Can write uncompressed streams to an AVI file as well as raw mpeg2 files in pass-through mode. The image format for uncom- pressed streams can be selected with -F (use -F help to see available formats). Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RAW (pass-through) RGB YUV DV YUV422 toolame - (audio) MPEG 1/2 This module has no compile-time dependencies. At run-time toolame and sox must be present. Support for this module is good. Drives the toolame binary to create MP2 audio tracks. Sox is used for resampling if requested. Supported processing formats: audio - PCM, video - none wav - (audio) WAVE PCM This module has no compile-time dependencies. This module has no run-time dependencies. Support for this module is good. Creates WAVE PCM files with interleaved audio for stereo. Supported processing formats: audio - PCM, video - RAW (pass-through) RGB YUV xvid4 - (video) XviD 1.0.x series (aka API 4.0) | (audio) MPEG/AC3/PCM At compile-time libmp3lame (only for MPEG audio layer III) must be available. At run-time libxvidcore.so.4 must be present. Support for this module is good. Encodes MPEG4 video using the library available from xvid.org. Check out the library from xvidcvs using cvs -d :pserver:anonymous@cvs.xvid.org:/xvid co -rdev-api-4 xvidcore. There is also a tool available to create configuration files for this xvid version at http://zebra.fh-weingarten.de/transcode/xvid4conf. The output can either be an AVI file or a MPEG4 elementary stream (with -F raw). Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RGB YUV YUV422 yuv4mpeg - (video) YUV4MPEG2 | (audio) MPEG/AC3/PCM At compile-time mjpegtools must be available. This module has no run-time dependencies. Support for this module is good. Writes the uncompressed raw YUV data in a YUV4MPEG format as used by the lav* and mjpeg* tools. Supported processing formats: audio - RAW (pass-through) PCM AC3, video - RGB YUV AUTHORS
transcode was written by Thomas Oestreich <ostreich@theorie.physik.uni-goettingen.de> with contributions from many others. See AUTHORS for details. SEE ALSO
transcode(1), tcmodinfo(1), transcode_import(1), transcode_filter(1), 1 modules transcode(export)
All times are GMT -4. The time now is 06:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy