Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How to convert all new mp4 to a directory using ffmpeg ?
11 août 2018, par Antonio MayconWhat bash script can use to accomplish this task through ffmpeg?
I want my script to run as a loop and check if there are new mp4 videos in the directory.
Afterwards, move the new files to another folder, if the file doesn't exist there yet.
If possible, I want to add a watermark to the video.
I have the code to add more files. I want to include it next to the script that does the conversion of the new files.
I created a bash file with the following data:
#! /bin/bash srcExt=$1 destExt=$2 srcDir=$3 destDir=$4 opts=$5 for filename in "$srcDir"/*.$srcExt; do basePath=${filename%.*} baseName=${basePath##*/} ffmpeg -i "$filename" $opts "$destDir"/"$baseName"."$destExt" -i logo.png -filter_complex overlay done echo "Conversion from ${srcExt} to ${destExt} complete!"
Later i then run the file:
./ffmpeg-batch.sh mp4 mp4 /folder-source-file/ /folder-output-files/ '-ab 128k'
-
Create an mp4 video from list of frames using ffmpeg
11 août 2018, par Yevgeni BurshteinI have an directory with images that looks like this:
frame0d.jpg frame1d.jpg frame2d.jpg ... frame4297d.jpg
I need to create mp4 file with 30 fps from them.
I've tried command:
ffmpeg -framerate 30 -i frame%04d.jpg video.mp4
But it fails with error:
[image2 @ 0000026fd7c5a000] Could find no file with path 'frame%04d.jpg' and index in the range 0-4 frame%04d.jpg: No such file or directory
Thanks a lot !
-
JavaFx MediaPlayer can't play my mp3 and m4a files converted by ffmpeg
10 août 2018, par FreewindI record some .wav files from microphone, and convert it to mp3 and m4a files. These files can be played with my desktop player correctly.
Then in my JavaFX program, I play them as:
String fileUri = file.toURI().toString(); Media media = new Media(fileUri); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.play();
But there is no sound, and no errors.
I use
ffmpeg
to view them:ffmpeg -i demo.m4a
Input #0, aac, from 'demo.m4a': Duration: 00:00:54.00, bitrate: 132 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 132 kb/s
ffmpeg -i hello.mp3
Input #0, mp3, from 'hello.mp3': Metadata: encoder : Lavf57.83.100 Duration: 00:00:01.12, start: 0.069063, bitrate: 49 kb/s Stream #0:0: Audio: mp3, 16000 Hz, stereo, s16p, 48 kb/s
And use this command to convert by ffmpeg:
ffmpeg -i hello.wav hello.mp3
Not sure where is wrong.
Update: finally I use this command to generate mp3 which can be played by JavaFx
ffmpeg -i hello.wav -f mp2 hello.mp3
(also can add
-c:a libmp3lame
to generate smaller size mp3)Seems like JavaFx only supports
mp2
format of mp3 files. -
FFMPEG error when making animations with certain frame dimensions
10 août 2018, par jtamI have been using ffmpeg to successfully generate animations of png images with a size of 7205x4308 with the following command:
-framerate 25 -f image2 -start_number 1 -i fig%4d.png -f mp4 -vf scale=-2:ih -vcodec libx264 -pix_fmt yuv420p 2015-2018.mp4
When I try to run the same command for a group of images with a different size, e.g., 6404x5575, I get the following error:
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed!
I have concluded that the reason it is failing has something to do with the frame size because that is the only thing that is different between the first successful animation and the one that is failing. But, my intuition could be wrong(?). I have tried to remove the scaling parameter in the command but I get the same error.
I am using ffmpeg version 3.4.2 on Mac OSX 10.13 via python.
Any help would be much appreciated. Thanks!
-
JavaFx MediaPlayer can't play my mp3 and m4a files
10 août 2018, par FreewindI record some .wav files from microphone, and convert it to mp3 and m4a files. These files can be played with my desktop player correctly.
Then in my JavaFX program, I play them as:
String fileUri = file.toURI().toString(); Media media = new Media(fileUri); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.play();
But there is no sound, and no errors.
I use
ffmpeg
to view them:ffmpeg -i demo.m4a
Input #0, aac, from 'demo.m4a': Duration: 00:00:54.00, bitrate: 132 kb/s Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 132 kb/s
ffmpeg -i hello.mp3
Input #0, mp3, from 'hello.mp3': Metadata: encoder : Lavf57.83.100 Duration: 00:00:01.12, start: 0.069063, bitrate: 49 kb/s Stream #0:0: Audio: mp3, 16000 Hz, stereo, s16p, 48 kb/s
Not sure where is wrong.