VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    I'm working on a new feature for FFQueue but I've got stuck with a problem: The goal is to take a series of images of differens sizes and shapes and make them fit into a video of predefined size. The command I'm trying with is:

    Code:
    ffmpeg -framerate 1/2 -i "%d.jpg" -vf "scale='if(gt(iw,ih),800,-1)':'if(gt(ih, iw),600,-1)', scale='if(mod(iw, 2), iw-1, iw)':'if(mod(ih, 2), ih-1, ih)', pad=800:600:(ow-iw)/2:(oh-ih)/2:black, fps=fps=25, format=yuv420p" -b:v 1000k -shortest -y slideshow.mp4
    The -framereate makes the individual images have a rate of 1 image per 2 seconds. The filtering used: The first "scale" is ment to fit the input image into an area of no more than 800x600 pixels. The second "scale" is ment to prevent images from having odd width and/or height. The "pad" is ment to center the scaled image in a black box of 800x600 pixels. The "fps" forces the output to a framerate of 25, and "format" is used to force the pixel format.

    When running the command I get a lot of "deprecated pixel format" warnings spiced with some "frame size changed" messages - but no errors. The ouput video contains some images - both landscape and portrait that are correctly scaled and padded to 800x600. But annoyingly a lot of frames are irradically dropped. Out of 16 frames 11 are dropped (with no obvious reason) and other frames are duplicated to create a video of 32 seconds (16 imgs, 2 secs per img). Some images are shown for up to 10 seconds and other images are shown for exactly 2 seconds.

    I've tried to use different image sets and I've tried to use "-vsync" in various ways. I've tried to use "-r" both before and after the input with various unwanted results. Am I doing something wrong or is ffmpeg just not capable of doing what I want it to?
    Quote Quote  
  2. "deprecated pixel format"
    -> "-pix_fmt yuv420p", before the output should fix that

    about the randomly dropping frames, try using '-f image2 -r 1/2' instead of '-framerate 1/2'
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    Originally Posted by Selur View Post
    "deprecated pixel format"
    -> "-pix_fmt yuv420p", before the output should fix that

    about the randomly dropping frames, try using '-f image2 -r 1/2' instead of '-framerate 1/2'
    Neither setting -pix_fmt or replacing -framerate with -r fixes the issues. Replacing -framerate with -r is AFAIK wrong since the image2 demuxer (which is auto-selected even without -f image2) requires the -framerate option according to ffmpeg docs:

    https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images

    I've come to the conclusion that it is not possible to do the job with scaling and padding in one batch. First the images must be scaled and padded in a job and then the new images must be used for creating the resulting video in another job. Even then either first or last frame is randomly skipped - but this can bodged with a setpts filter.

    For now I've got a working "images to video" tool created for FFQueue - thanks anyway
    Quote Quote  
  4. Strange that setting the pix_fmt doesn't fix the "deprecated pixel format" issue, but happy you found a solution for you tool.
    By the way, if you plan to add further features for this, implementing some sort of 'seam carving' (http://en.wikipedia.org/wiki/Seam_carving) would be cool, but that would require more work since ffmpeg doesn't offer this.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    Originally Posted by Selur View Post
    Strange that setting the pix_fmt doesn't fix the "deprecated pixel format" issue, but happy you found a solution for you tool.
    By the way, if you plan to add further features for this, implementing some sort of 'seam carving' (http://en.wikipedia.org/wiki/Seam_carving) would be cool, but that would require more work since ffmpeg doesn't offer this.
    FFQueue is a FFMpeg GUI. So you might want to request seam carving from the FFMpeg team if you want it in FFQueue
    Quote Quote  
  6. Like I wrote " that would require more work since ffmpeg doesn't offer this".

    Don't need it but thought that it might be a nice feature to have assuming you want to ' to take a series of images of differens sizes and shapes and make them fit into a video of predefined size'.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  7. Member
    Join Date
    Jul 2014
    Location
    Denmark
    Search Comp PM
    Originally Posted by Selur View Post
    Like I wrote " that would require more work since ffmpeg doesn't offer this".

    Don't need it but thought that it might be a nice feature to have assuming you want to ' to take a series of images of differens sizes and shapes and make them fit into a video of predefined size'.
    I agree - it would be a very nice feature. But ffq is still a gui for ffmpeg and not a video processor
    Quote Quote  
  8. No problem. If it's not in the scope of your project, that's fine.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!