Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques Total newbie :(

  • Total newbie :(

    Posted by Thomas Monk on April 2, 2013 at 4:16 pm

    I must be thick, because I just can’t get my head around ffmpeg. Here’s what I’m trying to do:

    I have a folder “C:frames” that contains 58656 jpg images (1920×1080). These images are named “frame-000000.jpg” to “frame-58655.jpg”. These images are not interlaced.

    I would like to be able to convert a consecutive number of these frames into both HD mpeg4 1920×1080 format and PAL mpeg2 DVD 720×576 format at high quality.

    Although the images are in 16×9 format, the image is actually 4×3 with black bars to each side. When converting to 720×576 I would like to crop the side bars.

    I’ve managed to create a movie with a single frame, but that’s about it. Please help.

    Thomas Monk replied 13 years, 1 month ago 4 Members · 15 Replies
  • 15 Replies
  • Lou Logan

    April 2, 2013 at 5:24 pm

    [Thomas Monk] “When converting to 720×576 I would like to crop the side bars.”

    How much from each side would you like to crop?

  • Thomas Monk

    April 3, 2013 at 8:17 am

    210 pixels from each side.

  • Thomas Monk

    April 3, 2013 at 1:43 pm

    Sorry, I left a zero out my last frame number, should be “frame-000000.jpg” to “frame-058655.jpg”.

  • Jim Sustacek

    April 3, 2013 at 1:51 pm

    Here’s a basic command to concatenate your images into a movie, based on this blog post about time-lapse movies:
    ffmpeg -f image2 -r 25 -i frame-%05d.jpg -c:v libx264 output.mp4
    “-r 25” is your frame rate, and “-c:v libx264” would be your codec/quality settings. Feel free to adjust those or swap in other codec/quality settings you may find around the web.

    You should also be able to use the crop filter (format width:height:x:y, see filtering guide here) and the “pal-dvd” target for your PAL DVD encode like this (although I haven’t tried it yet):
    ffmpeg -f image2 -r 25 -i frame-%05d.jpg filter="-vf crop=1440:1080:240:0" -target pal-dvd output.mpg

  • Jim Sustacek

    April 3, 2013 at 1:53 pm

    Amending my other post, which assumed 240 pixel cropping, here’s a 210 pixel crop:
    ffmpeg -f image2 -r 25 -i frame-%05d.jpg <b>filter="-vf crop=1500:1080:210:0"</b> -target pal-dvd output.mpg

  • Thomas Monk

    April 3, 2013 at 3:53 pm

    Thanks for your help Jim. Do I need to specify the full path; i.e. C:\frames\frame-%05d.jpg ? And in light of my slight filename amendment; i.e. frame-000000.jpg to frame-058655.jpg do I need to put frame-%06d.jpg ?

  • Thomas Monk

    April 3, 2013 at 7:35 pm

    Sorry Jim, but this doesn’t seem to work at all. I think something has gone awry with spurious formatting such as “ “.

  • Reuben Martin

    April 4, 2013 at 1:22 am

    Don’t copy the html “bold” tags that got placed in there for some reason.

  • Thomas Monk

    April 4, 2013 at 2:43 pm

    I’m running the following single line in a batch file (run.bat):

    ffmpeg -f image2 -start_number 7723 -r 25 -i /tmp/img%05d.jpg filter=”-vf crop=1500:1080:210:0″ -target pal-dvd output.mpg

    But ffmpeg keeps reporting that it cannot find the file:

    /tmp/imgC:Program Filesffmpegbinrun.bat05d.jpg

    For some reason % is being replaced by the path and name of my batch file.

    This is driving me bonkers!

  • Reuben Martin

    April 4, 2013 at 10:36 pm

    Using ffmpeg within a bat script is quite messy. It parses text differently than a posix compliant shell does.

    You will have to escape the “%” character in order to use it within a bat script. It’s been a long time since I’ve used bat files, but if I remember correctly you can escape that character by doubling it up. (“%%” in place of “%”)

    You might save yourself a lot of trouble by installing a windows port of bash, and using that to write shell scripts rather than bat scripts.

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy