ffmpegthumbnailer -t not working as expected - carrierwave

I'm trying to create a thumbnail 3 seconds into a mp4 video I've transcoded.
Running....ffmpegthumbnailer -c jpg -q 10 -s 175 -t 00:00:03.0 -a -i /<FILEPATH>/thumb_20160816182847.MP4 -o /<FILEPATH>/tmpfile.jpg
The thumbnail is still showing second 0...what am I doing incorrectly?
The command is successful.

Related

How can I load multiple tar images using nerdctl? (containerd)

There are around 10 container image files on the current directory, and I want to load them to my Kubernetes cluster that is using containerd as CRI.
[root#test tmp]# ls -1
test1.tar
test2.tar
test3.tar
...
I tried to load them at once using xargs but got the following result:
[root#test tmp]# ls -1 | xargs nerdctl load -i
unpacking image1:1.0 (sha256:...)...done
[root#test tmp]#
The first tar file was successfully loaded, but the command exited and the remaining tar files were not processed.
I have confirmed the command nerdctl load -i succeeded with exit code 0.
[root#test tmp]# nerdctl load -i test1.tar
unpacking image1:1.0 (sha256:...)...done
[root#test tmp]# echo $?
0
Does anyone know the cause?
Your actual ls command piped to xargs is seen as a single argument where file names are separated by null bytes (shortly said... see for example this article for a better in-depth analyze). If your version of xargs supports it, you can use the -0 option to take this into account:
ls -1 | xargs -0 nerdctl load -i
Meanwhile, this is not really safe and you should see why it's not a good idea to loop over ls output in your shell
I would rather transform the above to the following command:
for f in *.tar; do
nerdctl load -i "$f"
done

How do I attach multiple GIFs and adjust the FPS?

I want to attach several GIFs and then change the FPS to 10.
ffmpeg -f concat -safe 0 -i 1.txt -filter:v fps=fps=1 -c copy output.gif
Executing the above command will result in the following error:
Filtergraph 'fps=fps=10' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together.
Except for filter options to adjust the FPS, the following error will not occur, but another problem will occur.
Remove -c copy because you can't stream copy and filter the same stream at the same time.
ffmpeg -f concat -safe 0 -i 1.txt -filter:v fps=10 output.gif

how to load all saved docker images in parallel

I have 20 images TARed, now I want to load those images on another system. However, loading itself is taking 30 to 40 minutes. All images are independent of each other so all images loading should happen in parallel, I believe.
I tried solution like running load command in background(&) and wait till loading finishes, but observed that it is taking even more time. Any help here is highly appreciated.
Note:- not sure about the option -i to docker load command.
Try
find /path/to/image/archives/ -iname "*.tar" -o -iname "*.tar.xz" |xargs -r -P4 -i docker load -i {}
This will load Docker image archives in parallel (adjust -P4 to the desired number of parallel loads or set to -P0 for unlimited concurrency).
For speeding up the pulling/saving processes, you can use ideas from the snippet below:
#!/usr/bin/env bash
TEMP_FILE="docker-compose.image.pull.yaml"
image_name()
{
local name="$1"
echo "$name" | awk -F '[:/]' '{ print $1 }'
}
pull_images_file_gen()
{
local from_file="$1"
cat <<EOF >"$TEMP_FILE"
version: '3.4'
services:
EOF
while read -r line; do
cat <<EOF >>"$TEMP_FILE"
$(image_name "$line"):
image: $line
EOF
done < "$from_file"
}
save_images()
{
local from_file="$1"
while read -r line; do
docker save -o /tmp/"$(image_name "$line")".tar "$line" &>/dev/null & disown;
done < "$from_file"
}
pull_images_file_gen "images"
docker-compose -f $TEMP_FILE pull
save_images "images"
rm -f $TEMP_FILE
images - contains needed Docker images names list line by line.
Good luck!

How to use Fred's ImageMagick textcleaner script?

I want to do OCR on some of my images, but images are not quite very impressive. So, for cleaning it I wanted to use Fred's ImageMagick Textcleaner script. Command that I gave:-
sh textcleaner.sh input_file output_file -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20
This is the arguments which Fred has given on website itself. I am also doing for same sample image. But I don't think so any of my options are working everything is by default. And I keep getting this error also
textcleaner.sh: line 177: type: textcleaner.sh: not found
usage: dirname path
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
And At last I had to keep the files in same folder where my textcleaner script is. How can I make it global and give the absolute path to it rather than putting the files wherever textcleaner is.
It's a bash script - it says so in the first line - yet you are trying to run it in sh - which is not bash. You need to make the script executable, by running
chmod +x textcleaner
then you can run it properly using:
./textcleaner ... arguments ...
That should make the error message go away. Then try showing us a sample image so we can try and see what the problem is.
In my ImageMagick scripts, the syntax is script name ...arguments... input output. So your command should be
bash textcleaner.sh -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 input_file output_file
See my Pointers For Use (for further configuration) at my home page: http://www.fmwconcepts.com/imagemagick/index.php

Cannot suppress ffmpeg output from ruby

I have ruby on rails app that allows users to upload videos. When a video is added, I have a before_save filter that uses ffmpeg to generate a series of thumbnails. The problem is that ffmpeg is producing tons of console output when I'm saving a video item in the rails console, and when I run my tests.
My environment:
Host Machine: OS X 10.9.2
Vagrant Box: Ubuntu 10.04.4
ffmpeg version: SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3
ruby version: 1.9.3-p194
Command I'm running:
`ffmpeg -v 0 -ss #{timestamp} -i #{video_file.path} -y -f image2 -vcodec mjpeg -vframes 1 -s 640*360 #{thumbnail_path}/thumbnail#{i}.jpg`
This version of ffmpeg on my VM doesn't seem to care about the "-v 0" option. I've also tried "-loglevel quiet" which causes ffmpeg to error, indicating that the option isn't recognized (both loglevel and v work on my host machine's ffmpeg).
Tried using both exec() and system(), which both caused execution to hang. Tried to redirecting output to a file by doing:
`ffmpeg -v 0 -ss #{timestamp} -i #{video_file.path} -y -f image2 -vcodec mjpeg -vframes 1 -s 640*360 #{thumbnail_path}/thumbnail#{i}.jpg > #{thumbnail_path}/output.txt`
Still see output. Next I tried:
`ffmpeg -v 0 -ss #{timestamp} -i #{video_file.path} -y -f image2 -vcodec mjpeg -vframes 1 -s 640*360 #{thumbnail_path}/thumbnail#{i}.jpg &> dev/null`
Still seeing output! Finally I tried:
$stdout.reopen("#{thumbnail_path}/output.txt", "w")
$stderr.reopen("#{thumbnail_path}/error.txt", "w")
`ffmpeg -v 0 -ss #{timestamp} -i #{video_file.path} -y -f image2 -vcodec mjpeg -vframes 1 -s 640*360 #{thumbnail_path}/thumbnail#{i}.jpg`
$stdout = STDOUT
$stderr = STDERR
Holy cow, that worked! Well, sort of. No more verbose output when running tests, BUT somehow anytime this runs I get kicked out of the rails console.
Does anyone have a more elegant solution?
You can try :
ffmpeg ... >output.txt 2>&1
Which insert stdout and stderr in output.txt

Resources