Ffmpeg Img to Video = Could Find No File with Path

ffmpeg img to video = Could find no file with path

To match all jpg files in /tmp/stream use:

ffmpeg -framerate 25 -pattern_type glob -i '*.jpg'

For more specificity use additional glob patterns. For example, if you only want images from 2017-11-08 to 2017-11-10:

ffmpeg -framerate 25 -pattern_type glob -i '/tmp/stream/2017_11_{08,09,10}*.jpg'

For more info on glob patterns see man 7 glob.

FFMPEG Could find no file with path and No such file or directory

The %3d means a file name with 3 digits (range 000 to 999).

solution A : You must rename your files as 001.png or 016.png (not as 1.png or 16.png).

solution B : Use %d to avoid needing zeroes (no renaming).

-i "C:\Users\USER\Desktop\Pictures\%d.png"

FFMPEG says No such file or directory when trying to convert image sequence

The following definitely works:

ffmpeg -i images%06d.png -c:v libx264 -r 30 test.mp4 -y

However it doesn't work with GIF pictures.

You can losslessly convert your pictures to PNG and run the above command line.

ffmpeg says that file doesn't exist, but it actually exists

Your .ts file is in transcribation/transcribation.controller.ts but the file you are accessing is not in the same folder. It's actually 1 level up.

Make sure you are going 1 level up to access the videos

let process = new ffmpeg("../uploads/0.1831579264771055.mp4")

Create video from single images

Use %08d.png as there are 8 digits.

FFmpeg is not working with the media file path containing whitespace in name

Working solution

The parameters apparently needs to be strings to guarantee that they work correctly. The -t parameter (duration) had to be converted to a string, as discovered by Kamran Ashiq

Alternate suggestion (shouldn't be the case with this framwork, but useful general solution)

What's most likely happening is that ffmpeg sees the space as a separator for more parameters, such as multiple files.

You should be able to either quote or escape the path, so ffmpeg sees it as just one parameter instead of multiple.

E.g., when calling it on the command line one would either do:

$ ffmpeg -some -parameters "foo bar.mp4"
# or
$ ffmpeg -some -parameters foo\ bar.mp4

Similar in your code you should probably do:

RNFFmpeg.executeWithArguments(["-i", videoPath, "-i", songPath, "-c:v", "copy", "-c:a", "aac", "-map", "0:v:0", "-map", "1:a:0", "-t", duration, `"${path}${timeStamp}.mp4"`])

How to create a video from images with FFmpeg?

See the Create a video slideshow from images – FFmpeg

If your video does not show the frames correctly If you encounter problems, such as the first image is skipped or only shows for one frame, then use the fps video filter instead of -r for the output framerate

ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4

Alternatively the format video filter can be added to the filter chain to replace -pix_fmt yuv420p like "fps=25,format=yuv420p". The advantage of this method is that you can control which filter goes first

ffmpeg -r 1/5 -i img%03d.png -c:v libx264 -vf "fps=25,format=yuv420p" out.mp4

I tested below parameters, it worked for me

"e:\ffmpeg\ffmpeg.exe" -r 1/5 -start_number 0 -i "E:\images\01\padlock%3d.png" -c:v libx264 -vf "fps=25,format=yuv420p" e:\out.mp4

below parameters also worked but it always skips the first image

"e:\ffmpeg\ffmpeg.exe" -r 1/5 -start_number 0 -i "E:\images\01\padlock%3d.png" -c:v libx264 -r 30 -pix_fmt yuv420p e:\out.mp4

making a video from images placed in different folders

First, add image paths to imagepaths.txt like below.

# this is a comment details https://trac.ffmpeg.org/wiki/Concatenate

file 'E:\images\png\images__%3d.jpg'
file 'E:\images\jpg\images__%3d.jpg'

Sample usage as follows;

"h:\ffmpeg\ffmpeg.exe" -y -r 1/5 -f concat -safe 0 -i "E:\images\imagepaths.txt" -c:v libx264 -vf "fps=25,format=yuv420p" "e:\out.mp4"

-safe 0 parameter prevents Unsafe file name error

Related links

FFmpeg making a video from images placed in different folders

FFMPEG An Intermediate Guide/image sequence

Concatenate – FFmpeg

Can I pass a list of image into the input method of ffmpeg-python

You may use Concat demuxer:

  • Create a file mylist.txt with all the image files in the following format:

     file '/path/to/images/1.jpg'
    file '/path/to/images/2.jpg'
    file '/path/to/images/3.jpg'
    file '/path/to/images/20.jpg'
    file '/path/to/images/100.jpg'

    You may create mylist.txt manually, or create the text file using Python code.

  • Use the following command (you may select different codec):

     ffmpeg.input('mylist.txt', r='20', f='concat', safe='0').output('video.mp4', vcodec='libx264').run()

Second option:

Writing JPEG data into stdin PIPE of FFmpeg sub-process.

  • Create a list of JPEG file names (Python list).
  • Execute FFmpeg sub-process, with stdin PIPE as input, and jpeg_pipe input format.
  • Iterate the list, read the content of each file and write it to stdin PIPE.
  • Close stdin PIPE.

Here is a code sample:

import ffmpeg

# List of JPEG files
jpeg_files = ['/tmp/0001.jpg', '/tmp/0002.jpg', '/tmp/0003.jpg', '/tmp/0004.jpg', '/tmp/0005.jpg']

# Execute FFmpeg sub-process, with stdin pipe as input, and jpeg_pipe input format
process = ffmpeg.input('pipe:', r='20', f='jpeg_pipe').output('/tmp/video.mp4', vcodec='libx264').overwrite_output().run_async(pipe_stdin=True)

# Iterate jpeg_files, read the content of each file and write it to stdin
for in_file in jpeg_files:
with open(in_file, 'rb') as f:
# Read the JPEG file content to jpeg_data (bytes array)
jpeg_data = f.read()

# Write JPEG data to stdin pipe of FFmpeg process
process.stdin.write(jpeg_data)

# Close stdin pipe - FFmpeg fininsh encoding the output file.
process.stdin.close()
process.wait()


Related Topics



Leave a reply



Submit