date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,552,663,800,000 |
I want to rename files with a .m4a extension recursively in child directories to remove unwanted characters in audio files such as [ ' ].
That's because that this below happened to this file 04 Tears Don't Fall.m4a without the other files:
Could not load file 2005-09-30 - The Poison (Deluxe Edition) [US -
88697-0902... |
#!/bin/bash
shopt -s globstar
for fn in **/*\'*.m4a; do echo mv "$fn" "${fn/\'/}"; done
echo is needed for checking the result before real renaming.
| How to rename files recursively with a specific extension to remove unwanted characters in audio files |
1,552,663,800,000 |
I'm trying to record my screen losslessly (or at near lossless quality) with hardware acceleration on a 6700 XT with ffmpeg. I'm running Linux Mint with the 5.14.14-051414-generic kernel.
I've tried:
ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 2560x1440 -i :0 -r 60 -vf 'hwupload,scale_vaapi=format=... |
TL,DR: I think you've mostly hit bugs in ffmpeg and/or other parts of the stack that seem be fixed by now.
Your first command:
ffmpeg -vaapi_device /dev/dri/renderD128 -f x11grab -video_size 2560x1440 -i :0 -r 60 -vf 'hwupload,scale_vaapi=format=nv12' -c:v h264_vaapi -qp 0 output.mp4
Works for me, on Debian Bookworm w... | Hardware accelerated lossless recording on a 6700 XT using ffmpeg |
1,552,663,800,000 |
I have composed the following bash script to automatically concatenate mp3 files using ffmpeg:
i=0
for f in "${@:2}"
do
filter+="[$i:a:0]"
i=`expr $i + 1`
files+="-i $f "
done
filter+="concat=n=$i:v=0:a=1[outa]"
ffmpeg $files -filter_complex $filter -map '[outa]' "$1.mp3"
However, I often have... |
For clarity and safety when building command lines, arrays are your friend:
files=()
i=0
for f in "${@:2}"
do
filter+="[$((i++)):a:0]"
files+=(-i "$f")
done
filter+="concat=n=$i:v=0:a=1[outa]"
ffmpeg "${files[@]}" -filter_complex "$filter" -map '[outa]' "$1.mp3"
| ffmpeg: filenames with spaces from bash script |
1,552,663,800,000 |
I'm trying to identify files with high/low bitrate in my audio collection using a shell script. Doing file test.mp3 is very fast:
$time file test.mp3
test.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, Stereo
real 0m0.027s
However, file doesn't show the bitrate fo... |
My experience with these tags is that they're not approximate, they're wrong, especially for older VBR-encoded MP3 files, like, off by a factor of 8, sometimes. In general, things aren't better for MP4 (which pretty much uses variable bitrate; but "MP4" contains a large family of very different audio codecs with diffe... | Fast test for audio file bitrate |
1,552,663,800,000 |
I came accross this nice web. There are swf and mp3 files.
I'd like to convert them to mp4 or something, so it is viewable.
I tried gnash and ffmpeg without success.
I'm on Lubuntu 22.04
|
First of all, I'll mention some of the paths you shouldn't take and why nowadays (as long as you're running a modern distro):
Swivel can convert from swf to images/video, but it relies on Adobe AIR, which is not available on Linux.
Gnash has a dump-gnash command which might work and you might give it a go to export a ... | Convert swf files to mp4 |
1,552,663,800,000 |
The following script is meant to trim all media files in the current working directory.
#!/usr/bin/bash
trimmer() {
of=$(echo "${if}"|sed -E "s/(\.)([avimp4kvweb]{3,3}$)/\1trimmed\.\2/")
ffmpeg -hide_banner -loglevel warning -ss "${b}" -to "${ddecreased}" -i "${if}" -c copy "${of}"
echo "Success. Exiting .."
}
... |
Your code is essentially doing the following:
foo () {
read variable
}
while read something; do
foo
done <input-file
The intention is to have the read in foo read something from the terminal, however, it is being called in a context where the standard input stream is redirected from some file.
This means tha... | Why does the execution of these functions break out of this while loop? |
1,552,663,800,000 |
I'm following
Speeding up playback speed
https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
However, when I speed up my playback speed by 1.5, I'd anticipate a reduce of the video's size on par with/about the same level, yet, this is what I got:
-rwxrwxr-x 1 me me 10000000 2021-10-10 16:5... |
Most of the commands mentioned in that link change the playback speed. In order to reduce the number of frames, you do not necessarily need to change playback speed.
The minterpolate filter can reduce the number of frames, but it is a rather lossy process.
You could drop every other frame, but most people notice frame... | Speed up video by ffmpeg did not reduce file size |
1,619,126,357,000 |
I have a directory with some .flac files:
[test]$ ls
'test file (with $ign & parentheses).flac' 'test file with spaces.flac'
I want to run an ffmpeg test command on those files, i used find with -exec argument to achieve this:
find ./ -type f -iregex '.*\.flac' -exec sh -c 'ffmtest=$(ffmpeg -v error -i "{}" -f n... |
The {} is replaced literally by the filename, so put it somewhere that it doesn't get parsed specially. Since you're already using sh -c, the argument position seems ideal:
find ./ -type f -iregex '.*\.flac' -exec sh -c 'ffmtest=$(ffmpeg -v error -i "$1" -f null - 2>&1);if [ -n "$ffmtest" ];then echo -e "$1\n" $ffmt... | use find -exec with a filename containing a dollar sign ($) [duplicate] |
1,619,126,357,000 |
I noticed if I extract frames with this command:
ffmpeg -i sample_nosound.mp4 $filename%03d.jpg
It will extract depends on fps by default. ffmpeg -i sample_nosound.mp4 shows this video has 6 fps, so it extracted 1630 jpg frame files, which 1630/6 = 271.6 seconds equivalent to the 4:32 total video duration.
But 1630 j... |
As far as I understand the question, you want to extract the frames from the video. Each frame should be stored a separate file. The sum of all file's sizes is expected to match the video's file size. This is only true for some specific videos. I'll try to explain things broadly.
TL;DR
Extracting frames from h264 enco... | How to extract the “stored frames” without rely on fps? |
1,619,126,357,000 |
I have a command ffmpeg -loglevel panic -i source-video/test222.mp4 -acodec copy -f segment -segment_time 10 -vcodec copy -reset_timestamps 1 -map 0 ./tmp/%d.ts which break up a video into 10 second segments. This works on my Mac running ffmpeg 3.0.2 but not on my ec2. I have posted before and received no responses... |
Ideally, you'd want to install packages into your Linux system from a package repository. That is the easiest way to install (its very similar to the "Homebrew" system used on Mac, where brew is essentially a "source package manager"), the fastest and allows you to get additional updates in the future with the rest of... | ffmpeg command not working on ec2 [closed] |
1,619,126,357,000 |
I saw an answer here but when I tried it with dnf it says packages does not exist. I'm having the sample problem when I try to run videos in my built-in fedora 24 video player (I'm new to linux btw)
Any suggestions to solve this ?
|
Please install the below required packages using yum to resolve your isssue.
Enable the rpmfusion repository.
yum localinstall http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-24.noarch.rpm
yum localinstall http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-24.noarch.rpm
yum -y ... | H264 Mpeg-4 missing in fedora 24 |
1,619,126,357,000 |
I'm trying to stream my Gnome Desktop I installed on my OpenVZ VPS Server, and I'm not trying to run this from SSH, but the terminal inside the GNOME desktop,
I know it probably doesn't have a sound card, but it's not like i'm trying to play the sound, I just want to route it to the stream.
Inside my PulseAudio Volume... |
(hopefully) IMPROVED CODE AT BOTTOM
Reading the script provided in your own answer, I've reached the following conclusions about your solution. Please correct me on any/all mistakes I might have made.
You append an xwininfo $GAME_WINDOW-specific dataset to a tmpfile dump after specifying $GAME_WINDOW's geometry via wm... | Alsa Pulse Audio cannot open audio device pulse (No such file or directory) pulse: Input/output error |
1,619,126,357,000 |
I’m on debian.
I am calling a ffmpeg process to generate a mp3. this gets called from a php script using shell_exec. This works fine 99% of the time.
Sometimes, the ffmpeg process doesn’t exit and I’m left with ffmpeg running for hours. I”m slowly tweaking the params and its happening less, but still crops up on occas... |
You can use timeout that runs a command with a time limit.
For example:
timeout 2 yes
Will echo 'y' for two seconds (it would go on forever otherwise).
| How to detect if a process runs longer than X seconds, then do something with it? |
1,619,126,357,000 |
Can someone please explain to me what is happening here? This is what I have reduced my situation down to:
# make 20 test gifs out of the same source file.
for i in {1..20}; do cp -p ../some-random-source-file.gif "${i}.gif"; done
# grab, then process them.
while read f; do echo "→ $f"; ffmpeg -i "$f" -y -loglevel ... |
ffmpeg reads stdin by default so it is consuming some characters. You should add the flag -nostdin:
ffmpeg -nostdin -i "$f" -y -loglevel quiet
| ffmpeg inside while loop with find unintentionally alters iteration variable |
1,619,126,357,000 |
The official tutorial https://trac.ffmpeg.org/wiki/StreamingGuide uses the -pix_fmt yuv420p option.
I used it too, copied it from the tutorial, and streaming from FFmpeg to Youtube works for me. However, it is not clear what it is for, and especially if it is a necessary option with Youtube, or if there is a better on... |
YUV420 is a color space that uses chroma subsampling to reduce the amount of data needed to represent an image. Chroma subsampling is a method of encoding images by implementing less resolution for chroma (color) information than for luma (brightness) information. This takes advantage of the human visual system’s lowe... | ffmpeg "-pix_fmt yuv420p" option when streaming on Youtube |
1,619,126,357,000 |
Ive been researching all of today and yesterday trying to find a solution, none have worked for me so far.
For example: https://stackoverflow.com/questions/5784661/how-do-you-convert-an-entire-directory-with-ffmpeg
I want to be able to loop over all files in a folder (such as /Music/), find any files in any directory ... |
#!/bin/bash
shopt -s globstar
src_dir="Music"
dest_dir="Music_new"
for orig_path in "${src_dir}"/**/*.flac; do
#Change first directory in the path
new_path=${orig_path/$src_dir/$dest_dir}
#Remove filename from new path. Only directories are left.
#They are needed for mkdir
dir_hier=${new_path%/... | How can I loop over all directories and subdirectories and find files with a specific extension, then run FFMPEG on them, then copy them to a new lib |
1,619,126,357,000 |
I'm trying to convert a bunch of video .ts files to .mp4, but the way I think I have to go, is that while finding the files with find pipe the results into a while loop, execute ffmpeg on each file and then remove the old .ts file that was converted.
This is what I get with find:
$ find ./ -iname "*.ts"
./Parent-Dir/v... |
After all, this was what worked perfectly for me:
find ./ -iname "*.ts" \
| while IFS= read -r video; do
ffmpeg -nostdin -i "${video}" -c:v libx264 -c:a aac "${video%.*}".mp4
rm -f "${video}"
done
From video.ts it will convert it to video.mp4. Exactly what I was looking for!
Inspired from this answer.
Th... | Convert .ts videos to .mp4 with find piped into while and ffmpeg? |
1,619,126,357,000 |
I'm trying to record a specific window, so I tried this answer.
But it gave me this error: Unknown input format: 'gdigrab'
I'm using ffmpeg version n4.4.
|
gdigrab is specific to Windows. For linux, x11grab is the relevant device.
Run ffmpeg -h demuxer=x11grab to see its options.
| ffmpeg Unknown input format: 'gdigrab' |
1,619,126,357,000 |
Issue:
I have an FFmpeg command that I've been running for months now to stream video into the /dev/shm directory. It had been working fine until relatively recently (e.g. within a week), now it throws a permission issue.
The command:
ffmpeg -threads 2 -video_size 640x480 -i /dev/video2 -c:v libx264 -f dash -streaming... |
If you are using snaps, this forum post indicates there are specific patterns that are allowed for files in /dev/shm:
/dev/shm/snap.<snapname>.*
Another forum member suggested this hack, although it is basically a security bypass:
$ mkdir /dev/shm/shared
$ mkdir ~/shmdir
$ sudo mount --bind /dev/shm/shared ~/shmdir
$... | FFmpeg cannot write file to /dev/shm: Permission Denied |
1,619,126,357,000 |
I'm used to the reverb effect in Audacity, and was wondering if the same or at least, similar effect would be done using ffmpeg alone (or at least, commandline tools only).
Any ways to do this with commandline tools (like ffmpeg) only? (working example is appreciated)
|
This is one working example to use a convolution reverb with ffmpeg:
ffmpeg -i input.wav -i "CUSTOM_museum hall.wav" -lavfi afir temp.mp3
I used one of the Lexicon impulse responses from this page.
| How to apply reverb effect to audio files using commandline tools only? |
1,619,126,357,000 |
I'm attempting to record video (a screen capture) on a Debian 10.4 laptop.
I'm using a command that used to work fine on Mint 19.3, on the same hardware. I'm guessing the version of ffmpeg is newer on Debian 10.4.
The command is:
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 10 -s 1366x768 -i :0.0 -qmin 1 -qmax 1 -vcod... |
I'm not sure this part is correct: -f alsa -ac 2 -i pulse
what about just -f pulse -ac 2 -i default instead?
| ffmpeg hangs with command that used to work |
1,619,126,357,000 |
The below command well works for trimming the output audio
ffmpeg -i input.mp3 -af silenceremove=1:0:-50dB output.mp3
However, I am concating several mp3 files,
ffmpeg -i 1.mp3 -i 2.mp3 -i 3.mp3 -filter_complex 'concat=n=3:v=0:a=1' out.mp3
and I need to trim the input audio before concat.
Is it possible to trim in... |
ffmpeg \
-i 1.mp3 \
-i 2.mp3 \
-i 3.mp3 \
-filter_complex '[1]silenceremove=1:0:-50dB[a1];\
[2]silenceremove=1:0:-50dB[a2];\
[3]silenceremove=1:0:-50dB[a3];\
[a1][0][a2][0][a3]concat=n=5:v=0:a=1' out.mp3
Source: How to trim input audio in ... | How to trim input audio by FFMPEG? |
1,619,126,357,000 |
FFmpeg says in the 4.1 docs,
The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which are incompatible with the GPLv2 and v3. To the best of our knowledge, they are compatible with the LGPL.
But it seems the OpenSSL license is Apache v2, and at least according to Apache,,
The Free Software Foundation c... |
The Github file you linked to clearly shows the license was modified, and that pretty recently:
@levitte Change license to the Apache License v2.0 1513331 on
Dec 6, 2018
The license before that seems to be some custom stuff, known as the "OpenSSL license", which may not have been compatible with GPL (2 or 3).
And ... | FFmpeg claims OpenSSL is not compatible with GPL v3? |
1,619,126,357,000 |
What I've tried:
gcc -L/path/to/lib/ -llib ...
gcc -l/path/to/lib/lib.so.x.x.x ...
Update ldconfig
Added path to LD_LIBRARY_PATH
file shows correct build version and link to the correct file
No matter what, I still get /usr/bin/ld: cannot find -lavfilter
Any ideas?
|
ld looks for shared libraries or linker scripts named libsomething.so, or static libraries named libsomething.a, where something matches the -lsomething parameter given to ld. Libraries named libsomething.so.x.y.z, where x.y.z is the library’s version, are used at runtime, not for building, and ld won’t use them.
You ... | LD cannot find lib even with specified path |
1,619,126,357,000 |
I need to subtract two time codes from each other, I have multiple in an array and the output looks like this:
**Input:**
echo ${arr3[0]}
echo ${arr3[1]}
**Output:**
00:00:22.180 --> 00:00:25.600
00:00:24.070 --> 00:00:27.790
In this example the following equation needs to take place 00:00:25.600 - 00:00:22.180 ... |
Given an array arr3 that contains sample data:
declare -a arr3=([0]="00:00:22.180 --> 00:00:25.600"
[1]="00:00:24.070 --> 00:00:27.790")
You could loop through each element in the array, strip out the start time and end time, convert them to fractional seconds, compute the duration, then covert that ... | Subtract two time codes |
1,619,126,357,000 |
So I have an almost working script for FFMPEG that merges an .aif and an .mp4 file with the same name into a single filename_output.mp4 but when I execute it I get a weird error saying that a file is non exsistent but it the file it is searching for has two file extensions. The script is executed in the same folder as... |
You have a double extension because you start off with
for file in *.aif
followed by
filename=$(basename "$file")
which will give you $filename with an .aif suffix. Then you do
ffmpeg -i "${filename}.aif" -i "${filename}.mp4"
So you end up with filenames with a .aif.aif and .aif.mp4 suffixes.
Instead, use basename... | FFMPEG Merging Script Error |
1,619,126,357,000 |
Let's say I have a 2 hour movie and I want to extract/copy audio in another file say 5 minutes between 01:25:00 and 01:30:00, is there a way to do that.
The file is in .avi format -
Format : AVI
Format/Info : Audio Video Interleave
File size ... |
Have you tried ffmpeg? Something like
ffmpeg -vn \ # no video
-ss 01:25:00 \ # start offset
-t 300 \ # duration
-i foo.avi bar.mp3
might do the trick.
| extracting/copying audio from a specific part of a video file, possible? |
1,619,126,357,000 |
Before I go ahead and wipe my whole system and start from scratch, is there a way I can avoid what just happened on trying to install ffmpeg? I still don't actually know the correct way to install it so it includes most functions which it DOES NOT on Centos 6.4 with STATIC version.
My /etc/lb folder is a mess after th... |
There are some licensing issues with some components of ffmpeg making it unpalatable to include in certain configurations for most distros, I think -- probably you are aware of this. Also, it includes a set of libraries that have been replaced some places with the libav fork.
If you are looking for static binaries, t... | Linux re install order of events to include ffmpeg |
1,619,126,357,000 |
Could anybody explain, why
ffmpeg -i input.mov -ss 00:00:10 -to 00:00:15 output1.mov
produces a 5-second video, from second 10 to second 15, whereas
ffmpeg -ss 00:00:10 -i input.mov -to 00:00:15 output2.mov
produces a 15-second video, from second 10 to second 25?
|
man ffmpeg:
As a general rule, options are applied to the next specified file. Therefore, order is important, and you can have the same option on the command line multiple times. Each occurrence is then applied to the next input or output file.
So, -ss 00:00:10 before -i seeks the input to position 10s.
So, -ss 00:0... | FFmpeg: The option 'to' works differently depending on where we put it. Why is it so? |
1,619,126,357,000 |
I'm trying to use FFmpeg to produce a stereoscopic side-by-side video (Full 3D SBS) from a left-right pair of videos.
If the two source videos were perfectly in sync, I could use:
ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack stereo.mp4
Unfortunately, the cameras were not synchronized and I determined that I... |
I ended up using the tpad filter in conjunction with hstack to delay the right side 30 frames, rather than trim the left side:
ffmpeg -i left.mp4 -i right.mp4 -filter_complex \
"[0:v]null [left]; \
[1:v]tpad=30:start_mode=add [right]; \
[left][right]hstack" \
stereo.mp4
(However without electronical... | Stacking two videos with a precise time offset |
1,619,126,357,000 |
I know... there are a lot of questions out there already about reducing the file size with ffmpeg.
But, here's why my question is a bit different, it addresses having difficult content. I think that there's an issue with the significant area of moving sea water in my source video.
From an h624 video off the phone a... |
So my question is, what do you do when the video contains a significant amount of fast moving background artefacts?
Leave it be and do not reencode. You could
Reduce its resolution or/and framerate
For videos with a lot of noise you could try using a noise removal filter
For videos with a lot of motion you could us... | ffmpeg re-encoding to h625 with video of Sea Water doubles file size |
1,619,126,357,000 |
So I have frame series of JPEG in a folder let's say folder cctv where inside of that folder is only series of JPEG with unix timestamp named in nanosecond.
I mean like this ( I used tail because too much to display).
.../uwc/cctv $ ls | tail
1660282994647450349.jpg
1660282994732146495.jpg
1660282994809953109.jpg
1660... |
here is one example command with ffmpeg how to create such video:
ffmpeg -framerate 30 -pattern_type glob -i '166*.jpg' -c:v libx264 -pix_fmt yuv420p out.mp4
This video is set to 30 FPS, H.264 codec. Feel free to change them if required.
For more info check this answer.
| Create MP4 or another playable video format from frame series of JPEG in a directory |
1,619,126,357,000 |
I'm to capturing 10 images from camera. Like so:
ffmpeg -hide_banner -loglevel error -f video4linux2 -i /dev/video0 -vframes 10 -video_size 640x480 test%3d.jpg
Since JPG is lossly, at I need to change the image format. Let's say tiff. Like so:
ffmpeg -hide_banner -loglevel error -f video4linux2 -i /dev/video0 -vframe... |
That solely depends on your source. Some cameras provide MJPEG/H.264 output, so it's hard to talk about "lossless" at all. Check ffmpeg output for more info.
I'm not entirely sure about TIFF (it has some compressed lossy forms AFAIK) but BMP and PNG formats are 100% lossless.
Another point to consider is that your cam... | How to make sure images captured by FFMPEG from USB is lossless? |
1,619,126,357,000 |
I am trying to create a bash script that moves/renames (and / or creates a symbolic link) to all video files that are shorter than 3 min.
So far I have this Find command:
find "$findpath" -maxdepth "2" -type f -name '*.mp4' -print -exec avprobe -v error -show_format_entry duration {} \;
and then
if [ $duration -ge $D... |
Does this do what you want?
dur_min=180
dur_max=3600 # or whatever you want the max to be
# find the appropriate files and deal with them one at a time
find "$findpath" -maxdepth 2 -type f -iname '*.mp4' -print |
while read file ; do
# read duration
duration="$(ffprobe -v quiet -print_format compa... | Move and rename video files (*.mp4) shorter than 3 min |
1,619,126,357,000 |
I wrote the following code which is meant to create a file with a list of low-resolution media files:
#!/usr/bin/bash
find "$PWD" -type f -iname "*.avi" -execdir ~/CS/SoftwareDevelopment/MySoftware/Bash/lowresolution_finder/printer.sh {} + >~/pCloudDrive/VisualArts/lowres.films
find "$PWD" -type f -iname "*.mkv" -exe... |
It looks like what you want is something like:
output=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "$1")
if [[ $output == [2345]* ]]
then
echo "$(realpath "$1")" "$output"
fi
I'm not sure why you used eval here at all. eval is used to execute strings that contain shell c... | Why doesn't `eval` work in this code? |
1,619,126,357,000 |
When I use youtube-dl, I use --recode-video mp4 to ensure output to MP4 (as well as -f bestvideo[height<=1080]+bestaudio/best[height<=1080]/best to limit downloads to 1080p resolution, max). So, videos I download from YouTube are usually transcoded via ffmpeg (I’m not enough of a an A/V person to know if the video tra... |
This is a list of available formats for sample 15 minute video.
$ youtube-dl -F https://www.youtube.com/watch?v=ItR1ViLHeP4
[youtube] ItR1ViLHeP4: Downloading webpage
[info] Available formats for ItR1ViLHeP4:
format code extension resolution note
249 webm audio only tiny 46k , webm_dash container,... | youtube-dl — optimizing transcoded videos with regard to file size |
1,619,126,357,000 |
This question will seems very weird, please take the time to read
1- I have a .sh containing a ffmpeg command (this commands works, here it's all ok)
2- I trigger the .sh via a API call to start recording (all good here too)
3- the ffmpeg start generating the .mp4
4- I want to symlink the .mp4 to .m3u8 (because safari... |
I have to admit that i didn't read your whole question but judging from the title this should work:
while [ ! -f /tmp/originalfile ] ; do sleep 1 ; done ; ln -s /tmp/originalfile /tmp/symlink
| Linux is there a way to wait for a file to be created to make a symlink |
1,619,126,357,000 |
I have some .tta files I downloaded from internet. I can play them on VLC locally, but they cannot be played from certain media player app, for example, an android app. So here I need to convert "tta" files to "mp3" or "wav" files. Since they're high resolution sound, I'd like to know how to convert them to wav (or fl... |
for i in *.tta; do
ffmpeg -i "$i" "${i%.tta}.wav"
done
| Convert TTA file to MP3 or WAV file? |
1,619,126,357,000 |
I've got a directory with thousands of images (png, jpg, bmp, etc.) and thousands of videos (mp4, mpv, mpeg, etc.).
The png images may be ~10 MB and I can open them one at a time in GIMP, reduce quality from 100% down to 92% and the image size goes down to ~2MB and the quality (to the eye) hardly changes.
How can I do... |
You can do it in a for loop as below
for f in *
do
extension="${f##*.}"
filename="${f%.*}"
ffmpeg -i "$f" -q:v 1 "$filename"_lq."$extension"
rm -f "$f"
done
By increasing the number -q:v 1 the quality will be more reduced.
| ffmpeg batch command to reduce file quality |
1,619,126,357,000 |
I have a few video files which have "humm" sound in the audio. So, I created the following script for batch processing. I am using ffmpeg, to extract audio to .mp3, and sox to denoise, which will output noise free mp3 file.
mkdir -p ./tmp;
for f in *.mp4;
do
title=${f%.mp4};
echo "Working on $f";
mv ./"$f... |
I found Answers for my own questions. There are 2 ways to solve this. Answer for my first question is...
1. How can I solve this? Or, how can I remove/trim 00.050 seconds from the beginning and add 00.050 seconds of silence at the end of the audio track?
Answer 1: This might be destructive as I am converting mp3 mul... | sox command is automatically adding delay in the begining of mp3 |
1,619,126,357,000 |
I use the following command for my script to record the entire screen :
ffmpeg -f x11grab -y -r 24 -s 1366x768 -i :0.0 -f alsa -i default -vcodec libx264 out.avi
But after running that , out.avi doesn't contain video , just sound.
Here's the complete output of that (interrupted via Ctrl+C ) :
ffmpeg version 3.4.6-0u... |
Depends which app you are using to play your screencast. VLC simply failed, citing a "hardware accelerator failed to decode picture".
When changing to "X11 video output (XCB) I could see that video - with an offset due to a 2 display setup... The frames are captured but the codec seems strange: High 4:4:4 Predictive@L... | No video recorded when using x264 codec in ffmpeg |
1,619,126,357,000 |
Months ago I would occasionally record little snippets of audio as FLAC files using ffmpeg and ALSA. I used a command that looked more or less like this:
ffmpeg -f alsa -ar 48000 -ac 1 -acodec flac -i hw:0 testfile.flac
(hw:0 being my microphone's card via arecord -l)
If memory serves, there was one other option in t... |
Ffmpeg is capable of applying the same options to different inputs and outputs, which result in ffmpeg being sensitive to the position of the options.
The following will use your settings and output to a FLAC file (recognized by the file ending):
ffmpeg -f alsa -ar 48000 -ac 1 -i hw:0 testfile.flac
The settings are a... | How can one record mic audio straight to a FLAC file? |
1,619,126,357,000 |
Example :
Content of the playlist file:
(0:00:00) Abcde efgh ijk
(0:04:28) bcdea gefgh idjk
(0:17:00) qbecde efgh ijk
(0:27:40) hebcde efgh ijk
(0:35:03) Abeds esdh dfk
(0:49:16) dfhks ierkld sls
(0:58:26) dhekd sdoemc ks
(1:09:40) whdjoc dlf fg
...
I am looking for a way to slice a video by taking the -ss, -t and ou... |
With awk:
awk -v input="bla.mp4" -v to_last="1:23:45" -F'[()]' '
BEGIN {
str="ffmpeg -ss \"%s\" -i \"%s\" -to \"%s\" -c copy -r 30 -c:v libx264rgb -crf 0 -preset ultrafast -c:a aac \"%s_%s.mp4\"\n"
}
NR>1 {
printf str, ss, input, $2, ++cnt, output
}
{ ss=$2; sub(/^ /,"",$3); output=$3 }
END {
... | Slicing a video with arbitrary seek times from an input file (playlist) |
1,619,126,357,000 |
I'm trying to convert some audio files from FLAC to ALAC (m4a) using ffmpeg. For my environment (Apple & Sonos), the lowest common denominator seems to be as follows:
ALAC (.m4a) encoding at 44.1kHz, & bit depth = 16 bits
The problem I'm having is that the output file produced by ffmpeg has a bit depth of '32p'; ... |
This works here.
ffmpeg -i in -c:a alac -ar 44100 -sample_fmt s16p -c:v png -vsync 0 out.m4a
Note that ALAC encoder checks if the raw frame is 16-bit planar
| ffmpeg only outputs at bit depth s32p when converting from flac to alac |
1,619,126,357,000 |
The video created by this command:
ffmpeg -y -framerate 25 -i picture.png -i sound.wav -vcodec libx264 -crf 20 -preset medium -acodec aac -vf scale=1280:-2,format=yuv420p output.mp4
is not accepted ("Video assets: Your mezzanine file has failed.") by Amazon Prime.
How to make a video accepted by such a third party?
|
Your video input is a single frame, which lasts 0.04 seconds. Likely the cause of your submission failure. Loop the image indefinitely and then tell ffmpeg to stop output file with shortest stream (the audio).
ffmpeg -y -framerate 25 -loop 1 -i picture.png -i sound.wav -vf scale=1280:-2,format=yuv420p -vcodec libx264 ... | ffmpeg creates a broken video |
1,576,367,634,000 |
I'm struggling to find a one line command to merge new subtitle and delete existing ones from video file.
Example:
test1.mkv (already contain softcoded subs, dont need them)
test1.srt (only subtitle that i want on video)
Working under ubuntu server 18.04 LTS 64bit
Any help?
SOLUTION UPDATE;
mkvmerge -o output.mkv -S ... |
I will recommand to use mkvtoolnix
A package exits for ubuntu https://packages.ubuntu.com/bionic/mkvtoolnix
with the right combination of mkvextract and mkvmerge you can do what you want .
And you will use mkvinfo to display information about your file .
to install ...
apt-get install mkvtoolnix
to see a list of c... | ffmpeg add new srt and delete old ones |
1,576,367,634,000 |
When I tra to extract q frame at second 1 from a video file it says this:
(running via ssh on synology diskstation with ffmpeg installed)
Error with output (COMMAND ON TOP) (https://i.sstatic.net/hhUyA.jpg)
|
My ffmpeg was outdated and didnt support currrent switches and options.
| FFMPEG - Extracting a frame from .mov doesnt work (multiply errors) |
1,576,367,634,000 |
I like to compress large video files before storing them to hard disk. In Fedora-29-bash, I currently use the following ffmpeg command for re-encoding; it balances compression with quality:
ffmpeg -i $in_path -b:v 960k -bufsize 9600k -strict -2 $out_path
When executing the above command against a 2gb video file that... |
For MKV or MP4, the default video codec is libx264, which has a set of presets, with different speed and quality tradeoffs. The default preset is medium. You can switch to a faster preset like veryfast. See list at https://trac.ffmpeg.org/wiki/Encode/H.264#crf
| Accelerating Video Conversion |
1,576,367,634,000 |
I use ffmpeg -i FILE_NAME -vf fps=1/1 FILE_NAME%05d.jpg -hide_banner to convert a single file to several images which keep the file name followed by 5 zeros, a counter and then ends with a .jpg.
How do I do the same thing to all, let's say .mov, files in a single folder, keeping the file naming convention the same?
I ... |
for FILE_NAME in *.mov
do
ffmpeg -i "$FILE_NAME" -vf fps=1/1 "$FILE_NAME"%05d.jpg -hide_banner
done
This will result in output files named like something.mov00000.jpg. To remove the .mov or any other file type ending you can do
for FILE_NAME in *.mov
do
ffmpeg -i "$FILE_NAME" -vf fps=1/1 "${FILE_NAME%.*}"%05d... | Convert all video files in a folder to images per frame using ffmpeg iteratively |
1,576,367,634,000 |
I've got an .mkv with 1 video stream, 2 audio streams, and 12 subtitle tracks.
I want to turn it to greyscale, just use the first audio track, and use the eng subtitle track 6 (according to ffmpeg -i this is labeled as stream 0:11)
I'm running a filter to turn the video to greyscale (taken from ffmpeg documentation), ... |
Use this:
$ ffmpeg -i color.mkv -vf format=gray -map 0:v -map 0:a:0 -map 0:11 \
-c:a copy -c:s copy grey.mkv
The maps set which tracks to include. The c with specifiers set the codec operation to copy for those specified streams.
| FFMPEG run a video filter and copy only 1 subtitle stream |
1,576,367,634,000 |
I have a video that first audio stream is aac and the second is DTS. I want to copy the first one but re-encode the second one to aac.
The code I use usually is:
#!/bin/bash
ffmpeg -hide_banner -stats -i "Movie.mkv" -c:v libx265 -x265-params crf=20 -map 0 -c:a copy "MovieOut.mkv"
How to do this?
|
Use
ffmpeg -i "Movie.mkv" -map 0 -c:v libx265 -x265-params crf=20 -c:a:0 copy -c:a:1 aac "MovieOut.mkv"
| ffmpeg; copy stream 1 encode stream 2 |
1,576,367,634,000 |
At some point, I had an error with dependencies and had to remove some forcefully with pacman -Rdd libvpx libx264.
I have since reinstalled them, however I get this error upon each yaourt -Syua:
error: missing 'libvpx.so=4-64' dependency for 'ffmpeg0.10'
error: missing 'libx264.so=148-64' dependency for 'ffmpeg0.10'
... |
You don't get the error when you run pacman because these libraries are not part of the official repositories, they are dependencies of an AUR package.
Yaourt is not your package manager, it is an AUR helper: use it to help you install and manage AUR packages (or a better solution, use one that is not insecure and bug... | What is this ffmpeg dependency error telling me and how do I fix it? |
1,576,367,634,000 |
my HD Homerun for PLEX saves .TS files (transport stream).
in order to shrink this to 720 i use the following script:
#!/bin/bash
for INF in *.ts
do ffmpeg -i "$INF" -vf scale=-1:720 -c:v libx264 -crf 23 -preset ultrafast -c:a copy "${INF%.*}.mp4"
done
this works well and converts every .TS in folder .sh scrip... |
How about this:
for x in *.ts
do
y=$(basename "$x" .ts)
ffmpeg -i "$x" "$y".mp4
ffmpeg -i "$x" "$y".srt
done
| Bash Script with ffmpeg |
1,576,367,634,000 |
I often create digital animations by preparing all the frames in .png format (with minimal compression), that I need to convert to video format for upload to websites such as reddit, instagram, gfycat.
I know very little of all the different standards of compression, and these websites aren't very clear as to what for... |
ffmpeg
As pointed out in the comments, ffmpeg offers a good one-step solution with a simple "quality" parameter: crf, or "constant rate factor" (read this post explaining crf).
See this post for simple instructions for going from PNG to H.264 using ffmpeg.
In short:
# Assuming the frames are called frame0000.png, fram... | H.264/MPEG-4 from PNG frames: how to, and how to tune compression |
1,576,367,634,000 |
I am trying to compile FFmpeg in CentOS from source code. I referenced the official compilation guide (https://trac.ffmpeg.org/wiki/CompilationGuide/Centos) for CentOS step by step, and have installed the listed dependencies. But when I tried to configure FFmpeg, I met with a problem as below:
The error lines (1249~1... |
Turns out (for reasons yet unknown) that any executable placed in /tmp on your system segfaults. Even cp /bin/ls /tmp && cd /tmp && ./ls gives an ls that segfaults. But if moved to your home directory, then it works.
That is breaking configure; the obvious workaround is to create a subdirectory of your home directory... | error while configuring FFmpeg in CentOS: Segmentation fault & gcc is unable to create an executable file |
1,576,367,634,000 |
In ncmpcpp (an itunes-like ncurses client for mpd) I sort my music files by ALBUMARTIST tag. In my collection I have mp4 files, then mp4 doesn’t support ALBUMARTIST tag and all mp4 goe to “empty” section in not with others files in the same album.
So, how can I force to set an ALBUMARTIST tag for mp4 or, if it isn’t p... |
MP4s do apparently support the Album Artist tag. Using ffmpeg, the syntax is
ffmpeg -i in.mp4 -c copy -metadata album_artist="YourArtist" out.mp4
In Mediainfo, this shows up as "Artist/Performer: YourArtist"
BTW, the comment by @ridgy has it backwards. Tags are the purview of containers, not codecs. The tag writing ... | ALBUMARTIST tag is not known for mp4 |
1,576,367,634,000 |
How can I make the waveform white in colour? No matter what I do I get brown. This is presumably green and red combined?
for i in *.mp3 ; do
ffmpeg -i "$i" -loop 1 -i background.jpg -filter_complex "[0:a]showwaves=s=1280x720:mode=line,format=rgba,colorkey=0x000000:0.1:0.5[fg]; \
[1:v]scale=1280:-1,crop=iw:720[bg]; \
... |
Each channel has it's own default color, and overlapping channels will combine colors but there are several options to deal with this.
Choose the channel colors
showwaves=s=1280x720:mode=line:colors=white
Split the channels
showwaves=s=1280x720:mode=line:colors=white:split_channels=1
Make a mono waveform
aformat=... | Change FFmpeg waveform colour overlaid over image |
1,576,367,634,000 |
I'm having trouble installing the ffmpeg on my CentOS 6.8.
Before I settled from this tutorial.
Today can no longer, key links returns a 'Not found' on the island.
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
curl: (22) The requested URL returned error: 404 Not Found
error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: ... |
After many attempts to get installed and made an explanatory tutorial on how to install FFmpeg on CentOS!
Link: http://central.lpservidor.org/knowledgebase.php?action=displayarticle&id=36
| Error Installing ffmpeg on CentOS 6.8 |
1,576,367,634,000 |
Help me debugs this script to create control ffmpeg from a bash script.
for f in $FILES
do
INPUT_MOVIE=`basename "${f%.*}.mkv"`
OUTPUT_MOVIE=${MOVIE:1}
OUTPUT_MOVIE=${OUTPUT_MOVIE:0:2}") processed "${OUTPUT_MOVIE:2}
/usr/bin/ffmpeg -i $INPUT_MOVIE -map 0:0 -vcodec copy -map 0:1 -acodec copy $OUTPUT_MOV... |
Would this work for your purposes?
for i in *.mkv; do ffmpeg -i "$i" … ;done
| bash script controlling ffmpeg to convert from mkv |
1,576,367,634,000 |
I'm using i3wm and I want a script to run after I've unlocked my
screen. I can get this to work when I manually lock my screen,
e.g. using the steps outlined in
this
post.
But I can't get this to work after my screen is automatically unlocked,
e.g. via xautolock. For example,
xautolock -time 5 -locker "blurlock -n && ... |
After a lot of experimenting, I'm reasonably sure that using nohup before the ffmpeg command fixes the problem. That is, the above line in my_script.sh should be changed to:
nohup ffmpeg -f video4linux2 -s vga -i /dev/video-cam $HOME/Pictures/test.jpg > /dev/null 2>&1
| Use `xautolock` to run script which captures image with `ffmpeg` after unlocking |
1,576,367,634,000 |
I'm capturing an RTMP stream as HLS (saving playlist files) using FFMPEG wihout any stream processing, merely copying it.
Thanks to such setup I'm able to run tens of processes (I've tried 80 at most), with memory and CPU consumption not exceeding 30%.
This is my command:
ffmpeg -i <RTMP__STREAM_URL> -hls_init_time 10... |
Solved.
Turns out that had nothing to do with resources or any sort of performance. The videos were freezing because the processes had been overwriting each other's segments.
Apparently timestamps with milliseconds precision were not unique enough. I've fixed it by adding a randomly generated value to each process, wh... | Linux I/O issue? Multiple FFMPEG saving streams as HLS, lose segments despite low CPU and Memory consumption |
1,576,367,634,000 |
I installed the v4l2loopback kernel module on my machine and enabled it with sudo modprobe v4l2loopback exclusive_caps=1.
I created a camera on /dev/video0 with the rust bindings and started piping a static image to the camera (command from the wiki):
sudo ffmpeg -loop 1 -re -i 60828015.jpg -f v4l2 -vcodec rawvideo -p... |
From https://github.com/umlaeute/v4l2loopback/wiki/Faq
Depending on the color encoding, odd-sized frames can be problematic (eg YUV420p requires that the U and V planes are downsampled by a factor of 2, which works best if the width and height can be divided by 2). See also Issue #561
I changed the image size and th... | Chromium cannot read camera: Dequeued v4l2 buffer contains invalid length #561 |
1,688,329,302,000 |
Id like to create a video C with audio from video A but video from video B.
Video A and video B have nearly the same length in seconds.
Since the videos are a couple GBs, I guess it would be slower if I first extract audio from video A, then later merge that audio into video B (I mean, one step should be faster than t... |
I've been using this for a while:
ffmpeg -y \
-i "$videofile" \
-i "$audiofile" \
-c:v copy -c:a aac \
-map 0:v:0 -map 1:a:0 \
"$outfile"
I haven't tried it with files that are only "nearly" the same length, though.
| how to insert audio from video A into video B (no audio)? |
1,688,329,302,000 |
Resolve is a commercial video editor with a free version that can be run on linux.
On the linux version, some videos in mp4 format will have no video content when they are imported. This is apparently because the AAC codec is not supported by the free version Resolve on linux.
Apparently these videos can be transform... |
MPEG video files are not supported in free version of Davinci Resolve. You will have to convert to .mov file in order to use them.
The command you enter in your terminal is:
ffmpeg -i input.mp4 -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le -f mov output.mov
This is one solution. More solutions can be ... | How do transform mp4 videos so that they can be read by Davinci Resolve on Linux? |
1,688,329,302,000 |
I'm trying to record my screen, my mic, and my game audio with ffmpeg. This command records only my screen.
ffmpeg \
-video_size 2560x1440 \
-framerate 60 \
-f x11grab -i :0 \
-map 0 \
-c:a copy \
-c:v libx264rgb \
-crf 0 \
-preset ultrafast \
video.mkv
It records at a steady 60 fps, and ffmpeg gives the output
[x11g... |
For anyone having this problem in the future, I fixed it by opening pavucontrol during recording.
| ffmpeg recording slows down when audio inputs are added |
1,688,329,302,000 |
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -f alsa -i default -c:a aac -c:v libx264 -crf 18 -preset slower ~/Videos/recording-(date +%F-%I-%M).mp4
I'm using this command to record the screen and my intention is to record only the internal audio. But seems like the source is set to microphone. What will be correct command... |
Okay, after fiddling for an hour I found the solution.
At first I got pulseaudio output source by running pactl list short sources. Which showed me this list -
0 alsa_input.usb-046d_0825_3AC10B90-02.mono-fallback module-alsa-card.c s16le 1ch 48000Hz RUNNING
1 alsa_output.pci-0000_06_00.1.hdmi-stereo.monitor ... | How do I record just the internal audio with ffmpeg? |
1,688,329,302,000 |
I'm trying to write a simple shell script that I can use in my file manager Dolphin to merge selected images to GIF.
The following don't work, and I can't figure out the reason:
OUTPUT="$(kdialog --title "Merge to GIF" --inputbox "Please enter new file name:").gif"
INPUT="$(echo ${@} | sed -e 's/^/"/' -e 's/$/"/' -e '... |
I don't know why that one doesn't work, but this works:
OUTPUT="$(kdialog --title "Merge to GIF" --inputbox "Please enter new file name:").gif"
convert $(for i in "${@}"; do printf -- "-delay 60 %s " "$i"; done;) "$OUTPUT"
| Shell script to merge selected images to gif |
1,688,329,302,000 |
I've setup a webcam viewer that detects when a USB webcam is plugged in with a udev rule, then starts a systemd service that executes a script that starts an FFmpeg/FFplay webcam stream. I noticed when setting DISPLAY=:0 and XAUTHORITY=/home/pi/.Xauthority in the script before FFmpeg is started FFmpeg will run the str... |
After updating to Raspberry Pi OS Bullseye this issue appears to be fixed most likely due to them consolidating the video driver across all hardware. Unfortunately performance on Pi Zero W is worse on Bullseye. Oh well.
| Setting DISPLAY=:0 and XAUTHORITY=/home/pi/.Xauthority causes FFmpeg to run poorly |
1,688,329,302,000 |
I want to do something similar to the one on this guide but in that case both inputs have the same fps, I want to sync two distinct framerate inputs, here a sample:
ffmpeg \
-f x11grab \
-video_size 1920x1080 \
-framerate 60 \
-i :0.0 \
-f v4l2 \
-video_size 320x240 \
-framerate 15 \
-i /dev/video0 \
... |
I still don't know exactly why, but the following worked:
ffmpeg \
-f x11grab \
-video_size 1920x1080 \
-framerate 60 \
-i :0.0 \
-f v4l2 \
-video_size 320x240 \
-framerate 15 \
-i /dev/video0 \
-filter_complex '[0:v]setpts=RTCTIME-RTCSTART[dt];[1:v]setpts=PTS-STARTPTS[wc];[dt][wc]overlay=10:(H-h)/2[... | How to sync different fps video inputs |
1,688,329,302,000 |
I'm trying to create a command for converting all audio files selected in vifm using ffmpeg. Here's what I've tried so far:
command opus ffmpeg -i %f -q 7 %f:s|flac|opus|
This has two problems, however.
First, it only works if only one file is selected. If, for example, two are selected, ffmpeg stops with the questio... |
After hours of trial and error, I've managed to figure it out.
Write a bash script in a separate file, like ffmpeg-opus.sh:
#!/bin/bash
for file; do
ffmpeg -i "$file" -ab 128k "${file%.*}".opus
done
And create a command for it in vifmrc:
command opus ffmpeg-opus.sh %f
| Convert selected audio files in vifm using ffmpeg |
1,594,316,180,000 |
I am using Debian 9 with an older Radeon GPU (5450). I am interested in using the snap package of ffmpeg (which is version 4.1) because of some issues I may be able to fix with the newer snap instead of the Debian version (which is version 3.2.12-1~deb9u1). I have installed the snap package but receive the following e... |
My solution was to compile the newest version of ffmpeg. I use ffmpeg for screencasting, video compression, webcam recording, and film trimming. Therefore, it is likely you may need other options which you can see by running the following in your ffmpeg source folder:
./configure --help
Here were my options:
./config... | ffmpeg snap package error in Debian 9: libGL error: unable to load driver: r600_dri.so |
1,594,316,180,000 |
So I am using the following to convert all our videos in /home/vids to mp4 and output them in /home/vids2 but now I would like to add another video that plays before and after each video in /home/vids.
The video link is /home/intro/play.mp4 this video should be played before and after each of the videos in /home/vids.... |
If the videos are encoded using the same codecs you can utilize the concat operator.
If you have media files with exactly the same codec and codec parameters you can concatenate them as described in "Concatenation of files with same codecs". If you have media with different codecs you can concatenate them as describe... | ffmpeg add video to the start and end of another |
1,594,316,180,000 |
No idea why this is happening it's the first time I see this error. There seems to be enough space left in ram and drive.
First vnc fails now if I don't run it with -noshm option. Second one that fails is my screen grab inside ffmpeg. How can I prevent this from happening and how to fix it? Do I need to fully restart ... |
The problem in huge count of SystemV Shared memory Segments. You need to delete it with ipcrm command. But before check nattch field, that shows number of programs that using this segment. For example:
Your fragment:
------ Shared Memory Segments --------
key shmid owner perms bytes nattch ... | Programs started to fail suddenly with messages pertaining to shared memory |
1,594,316,180,000 |
I am attempting to batch download a number of videos using ffmpeg. A list of the site addresses and save names is stored in a text file in the following format.
"site",filename.mp4
The code that I have is looping through the file and attempting to download each line by line.
#!/bin/bash
while IFS=, read dl nm
do
... |
There's some issues with your script, in that you're using quotes in the file with download URLs/locations.
Namely, that when you have the file the way you do, $dl becomes "site" and$nm` remains as you'd expect.
In order to do this, you either need to change the file so that the site download locations don't have quot... | ffmpeg does not accept variable name read from file [closed] |
1,594,316,180,000 |
I basicly have this script:
#!/bin/bash
#Asks For filname and Word
echo 'Which word are you looking for?'
read word
echo 'What's the name of the file?'
read fileName
#Searches word and parses the line-numbers
wordOut=$(grep -i -n -w $word $fileName.srt |cut -f1 -d:)
#Sets all outputs to diffrent line numbers and ... |
I've fixed it myself by using another script and exporting the variables to the main script, so in the end I've used these two scripts.
Main script:
#!/bin/bash
echo 'Welk woord zoek je?'
read word
export word
for file in *.srt
do
fileName="$( basename "$file" .srt)"
export fileName
./actualScript
done
Actual scri... | Building a for loop around exsisting loop, to replace user input |
1,594,316,180,000 |
I am successfully capturing frames from a small USB IR camera on the small Raspberry Pi Linux board. I am using the 'libseek' code to do this:
https://github.com/zougloub/libseek
I can see alot of garbage being printed on the terminal when I remove the '|' symbol from the following command:
sudo ./build/seek-test \
... |
I would suggest to do something with gstreamer, like /build/seek-test | gst-launch-1.0 fbsrc ! videoparse width=208 height=156 format=gray16-le ! fbdevsink. Note that I didn't test it.
| Alternative to ffplay for Raw Video Playback without X Windows |
1,594,316,180,000 |
I want to create a movie from a bunch of png's by using the command:
avconv -i pics/*.png out.mp4
or
ffmpeg -r 1/1 -start_number 1 -i pics/*.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
However, in both cases I get:
Error while opening encoder for output stream #18:0 - maybe incorrect parameters such as bit_rat... |
The text with asterisk needs the sequential digit indicator %d instead, I think:
avconv -i 'pics/%d.png' out.mp4
ffmpeg -r 1/1 -start_number 1 -i 'pics/%d.png' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
quoting from avconv man page:
The pattern may contain the string "%d" or "%0Nd", which specifies the position ... | Error while making movie from png's with avconv or ffmpeg |
1,339,486,512,000 |
Since today when I run ffmpeg I have the error in the title of this question.
I tried this, but can't apply the solution because I have a directory /etc/ld.so.conf.d and in that directory there are the following files:
fakeroot-x86_64-linux-gnu.conf i386-linux-gnu.conf libc.conf x86_64-linux-gnu.conf
$ lsb_release ... |
If you're encountering an error with ffmpeg that suggests a library issue and you've noted the presence of various .conf files in /etc/ld.so.conf.d, it sounds like there might be a mismatch or a missing path in your library configuration. Given that you have Ubuntu 22.04.4 LTS, here's a streamlined approach to trouble... | ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: Error 74 |
1,339,486,512,000 |
So I have been trying filter out H265/HEVC and only show videos that are not the previous codec and then execute a command that I have that will transcode the video using my settings.
Every time I find a solution or a way I may manipulate into how I want it done, it doesn't work. Either an error of some kind or where ... |
I found the answer!
#!/bin/bash
IFS=$'\n'
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
# Bold
BRed='\033[1;31m' # Red
BGreen='\033[1;32m' # Green
for i in $(find /mnt/movies/ -type f -name '*.mkv' -o -name '*.mp4' -... | How to sort videos by codec and execute a command |
1,339,486,512,000 |
I have a video that I recorded with an interface using an XLR microphone (mono). The video recording software (Simple Screen Recorder), and my PulseAudio all saw that as a stereo source. Now I have a video with a stereo stream but only one audio channel. How can I correct this so sound plays from both speakers? Curren... |
One method to correct this is to use ffmpeg, using -c:v copy to leave the video screen alone and -map_channel to mark the new video as being stereo.
ffmpeg -i /tmp/in.mkv -map_channel 0.1.0 -c:v copy /tmp/out.mkv
| How can I reencode a video's audio when it was recorded in stereo with a mono source? |
1,339,486,512,000 |
I run
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
to configure opencv
and here are some of the check result
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: NO
-- FFMPEG: NO
-- avcodec: YES (ver 57.64.101)
-- avformat: ... |
I happen to be reinstalling my OpenCV recently and here are the steps to configure ffmepg.
1.Download the yum repository here to ~/Desktop
https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
2.Install the repository
sudo rpm -i ~/Desktop/rpmfusion-free-release-7.noarch.rpm
3.Install FFMPEG
su... | How do I make FFMPEG check yes while installing OPENCV |
1,339,486,512,000 |
how to convert video into webm format using ffmpeg and libvpx in centos
I have install ffmpeg and libvpx in centos.but it's doesn't convert mp4 format into webm format. but in windows i have check, it's working fine. what's wrong with my code / installation.how to find that.The code below,
FFMPEG path
/usr/bin/ffmpeg
... |
The ffmpeg version packaged in CentOS is too old to understand some of the options provided.
I'd suggest you to download a more recent version.
The easy way is to download the latest static build for your platform, you can find it here: http://johnvansickle.com/ffmpeg/ (choose 32 or 64 bit depending on your arch).
For... | how to convert video into webm format using ffmpeg in centos |
1,339,486,512,000 |
As I had to install my system from scratch I decided to play it safe this time around and follow the documentation for compiling ffmpeg on Centos via the ffmpeg.org site. I followed every command line by line without any errors until the very final one which was to do with the bash_profile.
If I look for ffmpeg on my... |
Based on your previous question, it seems that you followed the instructions too literally. I don't know which part exactly you should focus on (since I installed my ffmpeg manually instead of make install), but one of the arguments to ./configure needs to reflect the proper destination of the program (in your case, I... | ffmpeg not found [closed] |
1,339,486,512,000 |
I'm trying to use Ubuntu Linux 19.04 to convert an OpenShot video into a more efficient file-size.
The video only contains two still images, and 20 minutes of audio, but for each file-type I save-as, the output-file is larger than 600MB.
Apparently I'm choosing the wrong lossless output file-type; you'd think a video ... |
Your question is answered in the ffmpeg examples. You can use something like this:
ffmpeg -loop 1 -framerate 1 -i banner.png -i audio.wav -map 0 -map 1 -c:v libx264 -crf 16 -c:a aac -b:a 92k -shortest -movflags +faststart ready_to_upload.mp4
Detailed explanation:
-loop 1 repeat image potentially forever
-framerate ... | Using ffmpeg to Compressed a Two Frame Video |
1,387,878,201,000 |
If I'm logged in to a system via SSH, is there a way to copy a file back to my local system without firing up another terminal or screen session and doing scp or something similar or without doing SSH from the remote system back to the local system?
|
Master connection
It's easiest if you plan in advance.
Open a master connection the first time. For subsequent connections, route slave connections through the existing master connection. In your ~/.ssh/config, set up connection sharing to happen automatically:
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
I... | Copy a file back to local system with ssh |
1,387,878,201,000 |
I have two directories images and images2 with this structure in Linux:
/images/ad
/images/fe
/images/foo
... and other 4000 folders
and the other is like:
/images2/ad
/images2/fe
/images2/foo
... and other 4000 folders
Each of these folders contain images and the directories' names under images and imag... |
This is a job for rsync. There's no benefit to doing this manually with a shell loop unless you want to move the file rather than copy them.
rsync -a /path/to/source/ /path/to/destination
In your case:
rsync -a /images2/ /images/
(Note trailing slash on images2, otherwise it would copy to /images/images2.)
If images... | How to copy-merge two directories? |
1,387,878,201,000 |
Having migrated to Linux from Windows, I would like to find an alternative software to Winmerge or rather learn command line tools to compare and sync two folders on Linux. I would be grateful if you could tell me how to do the following tasks on the command line... (I have studied diff and rsync, but I still need som... |
This puts folder A into folder B:
rsync -avu --delete "/home/user/A" "/home/user/B"
If you want the contents of folders A and B to be the same, put /home/user/A/ (with the slash) as the source. This takes not the folder A but all of its content and puts it into folder B. Like this:
rsync -avu --delete "/home/user/A/"... | How to sync two folders with command line tools? |
1,387,878,201,000 |
I've seen in many places used install -d to create directories and install -c to copy a file. Why not use mkdir and cp? Is there an advantage in using install?
|
It depends on what you're doing.
The install command is normally used in installation scripts that come with packages and source code for installing a binary to your system. It can also be used to install any other file or directory. In addition to the -d and -c options you have -m for specifying the new permissions o... | Why use install rather than cp and mkdir? |
1,387,878,201,000 |
On occasion I've seen comments online along the lines of "make sure you set 'bs=' because the default value will take too long," and my own extremely-unscientific experiences of, "well that seemed to take longer than that other time last week" seem to bear that out. So whenever I use 'dd' (typically in the 1-2GB rang... |
dd dates from back when it was needed to translate old IBM mainframe tapes, and the block size had to match the one used to write the tape or data blocks would be skipped or truncated. (9-track tapes were finicky. Be glad they're long dead.) These days, the block size should be a multiple of the device sector size ... | Is there a way to determine the optimal value for the bs parameter to dd? |
1,387,878,201,000 |
I have a really strange situation here. My PC works fine, at least in most cases, but there's one thing that I can't deal with. When I try to copy a file from my pendrive, everything is ok -- I got 16-19M/s , it works pretty well. But when I try to copy something to the same pendrive, my PC freezes. The mouse pointer ... |
Are you using a 64-bit version of Linux with a lot of memory? In that case the problem could be that Linux can lock for minutes on big writes on slow devices like for
example SD cards or USB sticks. It's a known bug that should be fixed in newer kernels.
See http://lwn.net/Articles/572911/
Workaround: as root issue... | Why is my PC freezing while I'm copying a file to a pendrive? |
1,387,878,201,000 |
I am a graduate student, and the group in which I work maintains a Linux cluster. Each node of the cluster has its own local disk, but these local disks are relatively small and are not equipped with automatic backup. So the group owns a fileserver with many TBs of storage space. I am a relative Linux novice, so I ... |
%CPU should be low during a copy. The CPU tells the disk controller "grab data from sectors X–Y into memory buffer at Z". Then it goes and does something else (or sleep, if there is nothing else). The hardware triggers an interrupt when the data is in memory. Then the CPU has to copy it a few times, and tells the netw... | Is there a faster alternative to cp for copying large files (~20 GB)? |
1,387,878,201,000 |
I try to duplicate a video file x times from the command line by using a for loop, I've tried it like this, but it does not work:
for i in {1..100}; do cp test.ogg echo "test$1.ogg"; done
|
Your shell code has two issues:
The echo should not be there.
The variable $i ("dollar i") is mistyped as $1 ("dollar one") in the destination file name.
To make a copy of a file in the same directory as the file itself, use
cp thefile thecopy
If you use more than two arguments, e.g.
cp thefile theotherthing thecop... | Duplicate file x times in command shell |
1,387,878,201,000 |
I have a folder with a number of files in it ABC.* (there are roughly 100 such files). I want to duplicate them all to new files with names starting with DEF.*
So, I want
ABC.Page1
ABC.Page2
ABC.Topic12
...etc
copied to
DEF.Page1
DEF.Page2
DEF.Topic12
...etc
What is the simplest way to do this with a batch comman... |
How about something like this in bash:
for file in ABC.*; do cp "$file" "${file/ABC/DEF}";done
you can test it by putting echo in front of the cp command:
for file in ABC.*; do echo cp "$file" "${file/ABC/DEF}";done
| How do I copy multiple files by wildcard? |
1,387,878,201,000 |
To make the story short, I did an rsync:
rsync -avP [email protected]:/tmp/
And I forgot to put in my source directory...
I really meant to run:
rsync -avP /tmp/ [email protected]:/tmp/
It printed a bunch of files, but I don't know where it copied them because I didn't specify a destination. Does anyone know what hap... |
From man rsync:
Usages with just one SRC arg and no DEST arg will list the source files
instead of copying.
this as explanation below the invocation options, for you the invocation matches:
Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
| What happens when you rsync without a destination? |
1,387,878,201,000 |
I need to copy some files from a particular directory to a different location on a daily basis. I want to copy the changes only, so planning to use rsync. These files follows the following naming convention mysql-bin.*
My command looks as follows
# rsync --update -raz --progress /var/lib/mysql/mysql-bin.* /dbdata/bi... |
It looks OK. Although why are you using the -z option to compress the transfer? This option is normally used when you are copying to a remote rsync server over a slow network. In this instance it will compress and instantly decompress the files which will only increase your CPU uage with no benefit.
The -a (archive) ... | rsync to copy files which has changed |
1,387,878,201,000 |
Is there a method of slowing down the copy process on Linux?
I have a big file, say 10GB, and I'd like to copy it to another directory, but I don't want to copy it with full speed. Let's say I'd like to copy it with the speed of 1mb/s, not faster. I'd like to use a standard Linux cp command.
Is this possible? (If yes,... |
You can throttle a pipe with pv -qL (or cstream -t provides similar functionality)
tar -cf - . | pv -q -L 8192 | tar -C /your/usb -xvf -
-q removes stderr progress reporting.
The -L limit is in bytes.
More about the --rate-limit/-L flag from the man pv:
-L RATE, --rate-limit RATE
Limit the transfer to a maximum... | Make disk/disk copy slower |
1,387,878,201,000 |
I am trying to copy files over SSH, but cannot use scp due to not knowing the exact filename that I need. Although small binary files and text files transfer fine, large binary files get altered. Here is the file on the server:
remote$ ls -la
-rw-rw-r-- 1 user user 244970907 Aug 24 11:11 foo.gz
remote$ md5sum foo.gz ... |
TL;DR
Don't use -t. -t involves a pseudo-terminal on the remote host and should only be used to run visual applications from a terminal.
Explanation
The linefeed character (also known as newline or \n) is the one that when sent to a terminal tells the terminal to move its cursor down.
Yet, when you run seq 3 in a term... | Why is this binary file transferred over "ssh -t" being changed? |
1,387,878,201,000 |
If I want to make the contents of file2 match the contents of file1, I could obviously just run cp file1 file2.
However, if I want to preserve everything about file2 except the contents—owner, permissions, extended attributes, ACLs, hard links, etc., etc., then I wouldn't want to run cp.* In that case I just want to ... |
cat < file1 > file2 is not a UUOC. Classically, < and > do redirections which correspond to file descriptor duplications at the system level.
File descriptor duplications by themselves don’t do a thing (well, > redirections open with O_TRUNC, so to be accurate, output redirections do truncate the output file). Don’t l... | Is it a UUOC (useless use of cat) to redirect one file to another? |
1,387,878,201,000 |
I am using PuTTY on Windows 7 to SSH to my school computer lab. Can I transfer files from my Windows machine to my user on the school machines using SSH?
|
Use the PSCP tool from the putty download page:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
PSCP is the putty version of scp which is a cp (copy) over ssh command.
PSCP needs to be installed on your windows computer (just downloaded, really, there is no install process. In the Packaged Files secti... | Can I transfer files using SSH? |
1,387,878,201,000 |
I have a folder SOURCE that contains several sub-level folders, each with its own files.
I want to copy this folder in a new folder COPY where I need to copy the directory structure but keep the files as symbolic links to the original files in SOURCE and its subfolders.
|
Here's the solution on non-embedded Linux and Cygwin:
cp -as SOURCE/ COPY
Note that SOURCE must be an absolute path and have a trailing slash. If you want to give a relative path, you can use
cp -as "$(pwd)/SOURCE/" COPY
| How to copy a folder structure and make symbolic links to files? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.