LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2022, 11:57 PM   #1
mount.nfs
Member
 
Registered: Feb 2017
Posts: 59

Rep: Reputation: Disabled
ffmpeg different size .jpg to .mp4


Code:
./ffmpeg -r 0.3 -i %2d.jpg output.mp4
inputs 01.jpg, 02.jpg, 03.jpg, 04.jpg...

above command drop frames with size -s different .jpg

.jpg are size -s x*y different


please say what options missing command?

-vf pad=a:b:c:d

Last edited by mount.nfs; 03-30-2022 at 04:29 AM. Reason: -vf pad=
 
Old 03-30-2022, 12:45 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by mount.nfs View Post
Code:
./ffmpeg -r 0.3 -i %2d.jpg output.mp4
inputs 01.jpg, 02.jpg, 03.jpg, 04.jpg...

above command drop frames with size -s different .jpg

.jpg are size -s x*y different


please say what options missing command?
I don't understand, esp. "above command drop frames with size -s different .jpg". What do you want to achieve, what is failing?
 
Old 03-30-2022, 04:47 AM   #3
mount.nfs
Member
 
Registered: Feb 2017
Posts: 59

Original Poster
Rep: Reputation: Disabled
If I
-vf pad=a:b:c:d
.jpg one by one
then need to repeate many

I want some .jpg to a .mp4
and .jpg are in different resolutions

deprecated pixel format used, set range correctly
 
Old 03-30-2022, 10:58 AM   #4
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Simple solution.

First parse the files with ffmpeg and set all at the same resolution & size, then use ffmpeg to create the mp4. A simple script to process the files one at a time would handle that with only the delay needed for the sizing.

It can be done in a single pass but is much easier if you do one thing at a time and not jumping back and forth between tasks.
 
Old 03-30-2022, 01:32 PM   #5
mount.nfs
Member
 
Registered: Feb 2017
Posts: 59

Original Poster
Rep: Reputation: Disabled
Code:
./ffmpeg -r 0.3 -i %2d.jpg -vf pad=a:b:c:d output.mp4
 
Old 03-30-2022, 03:45 PM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
If the jpeg's are different size, then find the largest one and make the video that size, pad the rest of the jpegs to that size. Or pad all of them to a size larger than the largest jpeg.


Example where largest jpeg is 1000x600. Pad all the rest to that size. Images show for 5 seconds, 30 fps x264 mp4.
Code:
ffmpeg -framerate 1/5 -pattern_type glob -i '*.jpg' -vf scale=-1:-1,pad=1000:600:ow-iw/2:oh-ih/2 -c:v libx264 -crf 18 -preset slow -r 30 -pix_fmt yuv420p out.mp4
There are about 10 other ways to do that with ffmpeg.

Edit:
That will pad and center the smaller ones. Size them to 1000x600

Last edited by teckk; 03-30-2022 at 03:48 PM.
 
1 members found this post helpful.
Old 04-08-2022, 06:42 PM   #7
mount.nfs
Member
 
Registered: Feb 2017
Posts: 59

Original Poster
Rep: Reputation: Disabled
Code:
./ffmpeg -r 15 -i %2d.jpg output.mpeg
Code:
MPEG-1/2 does not support 15/1 fps
I tried the examples you give post #6

After more than a week, I reply with .mpeg problem

Last edited by mount.nfs; 04-09-2022 at 03:24 AM.
 
Old 04-08-2022, 11:54 PM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ well don't use .mpeg then.
Nobody suggested it, either.
Use .mp4, .mkv

(the name "ffmpeg" is somewhat historical at this point)

It looks like you aren't actually using the examples you're given?

I'm still a bit unsure what you're trying to achive there (some sort of slideshow as a movie, I guess), but generally speaking:
keep in mind that in ffmpeg it matters where you put command line options - before the input file, or before the output file.
 
Old 04-09-2022, 02:32 PM   #9
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
Got an image sequence.
https://www.signiant.com/wp-content/...s-1024x631.jpg
Code:
curl https://www.signiant.com/wp-content/uploads/2019/09/The_Horse_in_Motion_high_res-1024x631.jpg -o horse.jpg
Used scrot to cut it into 12 images. Didn't take the time to do a neat job.
Code:
scrot -s
Then made a slow animation with them
Code:
ffmpeg -framerate 1/.2 -i horse%d.png  -vf scale=-1:-1,pad=250:168:ow-iw/2:oh-ih/2 -c:v libx264 -crf 18 -preset slow -r 24 -pix_fmt yuv420p out.mp4
Looks like this
https://0x0.st/obln.mp4
 
Old 04-09-2022, 02:37 PM   #10
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
You could make that longer. I didn't spend much time with this. Do as good as you wish.

cat confile
Code:
file 'out.mp4'
file 'out.mp4'
file 'out.mp4'
file 'out.mp4'
Code:
ffmpeg -f concat -i confile -c:a copy -c:v copy longer.mp4
https://0x0.st/oblF.mp4
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Images on SD card now .JPG, used to be .jpg terry-duell Fedora 7 05-17-2012 09:45 PM
Rename all ".JPG" files to ".jpg" under all subfolders... jiapei100 Programming 4 04-25-2010 06:27 PM
How can make FVWM support JPG? can't make jpg as my wallpaper. jazzi Linux - Desktop 5 08-09-2008 02:54 PM
HELP! BASH - Convert filenames from dsc00***.jpg to *.jpg jimmybond01 Programming 9 05-08-2007 06:17 AM
renaming all JPG to jpg quickk Linux - Newbie 8 09-05-2004 01:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration