Reputation: 85
I am working with python in a jupyter notebook, and I am trying to use ffmpeg to specify the start and end images and convert several images from a folder into a single video. I have a folder, 'images', with the images inside labeled, 'image0', 'image1', 'image2', etc. I would like to specify the start and end images in my video. For example, I would like to be able to make the video using 'image100', to 'image200'. Right now, I have:
!/home/jovyan/ffmpeg-dir/ffmpeg -i /home/jovyan/images/image%d.bmp -frames:v 1000 /home/jovyan/output.mp4
This is making the video correctly, but I believe it is just taking the first 1000 images.
Thanks!
Upvotes: 6
Views: 10185
Reputation: 9
I was faced with one task to encode each 60-th frame with jpeg-lossless codec. The yuv-sequence had a fixed frame rate = 60fps. I applied the following -ss 00:00:01
to access 60-th frame:
ffmpeg -pix_fmt yuv420p -video_size 1920x1080 -r 60 -ss 00:00:01 -i test_1920x1080.yuv -frames:v 1 -vcodec jpegls -pix_fmt yuv420p -y test_frame60_ls.jpg
Notice: Despite explicitly declaring the output as format = yuv420p
, the format rgb24 was used instead.
Upvotes: -1
Reputation: 1896
Use -start_number
.
Use the -start_number option to declare a starting number for the sequence. This is useful if your sequence does not start with img001.jpg but is still in a numerical order.
(source: https://ffmpeg.org/faq.html#toc-How-do-I-encode-single-pictures-into-movies_003f)
For example, I would like to be able to make the video using 'image100', to 'image200'.
You need to combine -start_number 100
and -frames:v 101
(101 frames from image100.jpg
to image200.jpg
).
Upvotes: 9
Reputation: 744
You can try this:
ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4
OR
ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 -c copy cut.mp4
The -t option specifies a duration, not an end time. The above command will encode 8s of video starting at 3s. To start at 3s and end at 8s use -t 5. If you are using a current version of ffmpeg you can also replace -t with -to in the above command to end at the specified time.
Upvotes: 2