Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques How to Extract frames from a vide, process them and then reinsert them in their respective places

  • How to Extract frames from a vide, process them and then reinsert them in their respective places

    Posted by Yogi Yang on August 26, 2011 at 2:56 pm

    Hello I am new to FFMPEG and am trying to find solution for my typical requirements.

    I have a need for extracting a few frames from a given video file as JPEG files. Then process these files in Photoshop and after processing them I want to reinsert them into the same video file they were extracted from at their respective location.

    Is such an operation possible using FFMPEG?

    Thanks in advance.

    Yogi Yang replied 14 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Michael Rampe

    August 27, 2011 at 12:31 am

    [Yogi Yang] “I have a need for extracting a few frames from a given video file as JPEG files. Then process these files in Photoshop and after processing them I want to reinsert them into the same video file they were extracted from at their respective location.”

    Best option would be to dump the whole media file as an image sequence, process the frames you want without changing the size or filename and then convert the whole lot back to a new media file.

    There really is not an option to insert images otherwise.

    Michael

  • Yogi Yang

    August 31, 2011 at 7:06 am

    Thanks for your help.

    But then how should I handle Audio of that particular Video?

    Can you please guide me as I am new to FFMPEG?

    Thanks in advance.


    Yogi Yang

  • Michael Rampe

    September 1, 2011 at 12:44 am

    [Yogi Yang] “But then how should I handle Audio of that particular Video?

    Can you please guide me as I am new to FFMPEG?”

    sure.

    NOTE: “tilt_shift_4.mp4” has audio and video, is 1920×1080 and is 25 fps.

    To split the original to jpg files:

    $ ffmpeg -i tilt_shift_4.mp4 -vcodec mjpeg -sameq -f image2 temp-%03d.jpg

    Then edit the selected files you wish to change in Photoshop or your favourite image editing app. Save the file[s] (making sure the name does not change.

    To put them back together with the source audio and compress (using recent FFmpeg and libx264 in this example):

    $ ffmpeg -f image2 -i temp-%03d.jpg -i tilt_shift_4.mp4 -acodec copy -vcodec libx264 -b 2000k -preset medium -r 25 combined.mp4

    Let me know if this works for you….

    Michael

  • Yogi Yang

    September 2, 2011 at 6:45 am

    Thanks a lot for helping me out.

    It does work perfectly!

    What happens that most of the time I will have to produce mpg files and not mp4 files.

    I observed while experimenting that we cannot build mpg file with less than 25 fps. Any idea as to why. I am asking this because I have to process avi files and these files at times have very low frame rate like for example 12 fps.

    Thanks again.


    Yogi Yang

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