VideoHelp Forum
+ Reply to Thread
Results 1 to 13 of 13
Thread
  1. Member
    Join Date
    Apr 2011
    Location
    location, location
    Search Comp PM
    Hello all

    I am battling to find a truly lossless ffmpeg command that goes from video to images and back to video.

    If I pull png's from an mp4, with this command, I get high quality png's that are of identical quality to the original video.
    ffmpeg -i 'RHUBARB1.MP4' -r 29.97 -f image2 -vcodec png %05d.png"

    The original video is 1280x960 if that is relevant. Those are good quality PNG's. Now I try to put them back into an avi or whatever. I can't remember a history of all my attempts, but the closest I have got is
    ffmpeg -i '%05d.png' -s 1280x960 -r 29.97 -vcodec huffyuv -sameq rhubarb2.avi

    But rhubarb2 does not have the identical quality to rhubarb1. There is a slight colour shift, and slight banding on the gradients. These are very small changes, but I need to edit the images that I export and then reassemble them.

    Am I as close to "lossless" as I can get with ffmpeg, or am I missing a trick of some kind. thanks in advance to anyone who can help.
    Quote Quote  
  2. Member
    Join Date
    Apr 2011
    Location
    location, location
    Search Comp PM
    mov gets me closer
    ffmpeg -i '%05d.png' -s 1280x960 -r 29.97 -vcodec png -sameq rhubarb2.mov

    small change in darkness (gamma) but banding is gone. Hoorah!
    Quote Quote  
  3. try animation codec in RGB

    -vcodec qtrle

    ffmpeg -i '%05d.png' -s 1280x960 -r 29.97 -vcodec qtrle rhubarb2.mov



    Better yet, avoid the intermediate stage of PNG if you can. Most image formats are RGB. The quality loss is from RGB<=>Y'CbCr conversions. If you stay in lossless RGB, there will be no quality loss - but you are not starting from RGB.

    Your starting mp4 video is in Y'CbCr, so you should stay in Y'CbCr. If you convert to RGB, there is some quality loss ,and even more again when you convert to Y'CbCr format.
    Last edited by poisondeathray; 26th Apr 2011 at 09:24.
    Quote Quote  
  4. Member
    Join Date
    Jul 2009
    Location
    Spain
    Search Comp PM
    Originally Posted by vidgem View Post
    ffmpeg -i '%05d.png' -s 1280x960 -r 29.97 -vcodec png -sameq rhubarb2.mov
    You need to put the framerate before the input file(s), otherwise the input rate is taken as 25fps and frames will be duplicated to make it up to 29.97.

    ffmpeg -r 29.97 -i '%05d.png' ...
    Quote Quote  
  5. Member
    Join Date
    Apr 2011
    Location
    location, location
    Search Comp PM
    Originally Posted by poisondeathray View Post
    try animation codec in RGB

    -vcodec qtrle

    ffmpeg -i '%05d.png' -s 1280x960 -r 29.97 -vcodec qtrle rhubarb2.mov



    Better yet, avoid the intermediate stage of PNG if you can. Most image formats are RGB. The quality loss is from RGB<=>Y'CbCr conversions. If you stay in lossless RGB, there will be no quality loss - but you are not starting from RGB.

    Your starting mp4 video is in Y'CbCr, so you should stay in Y'CbCr. If you convert to RGB, there is some quality loss ,and even more again when you convert to Y'CbCr format.
    Thanks for taking the time to help. How do I export using ffmpeg to a YCbCr format image? The codecs I can see from my friend google are
    -vcodec ppm
    -vcodec png
    -vcodec mjpeg

    from what I can read, jpeg seems to have some trick up its sleeve about YCbCr (though I might not be understanding it correctly), but it definitely gives me a poorer quality export than png.
    Quote Quote  
  6. you can't avoid the quality loss, unless you stay in RGB (use an RGB video format)

    regular jpeg is lossy, so in addition to colorspace lossess, you incur compression losses

    why are you going to png in the first place? perhaps your editing/manipulations can be done in Y'CbCr with other programs
    Quote Quote  
  7. Member
    Join Date
    Apr 2011
    Location
    location, location
    Search Comp PM
    Originally Posted by Gavino View Post
    Originally Posted by vidgem View Post
    ffmpeg -i '%05d.png' -s 1280x960 -r 29.97 -vcodec png -sameq rhubarb2.mov
    You need to put the framerate before the input file(s), otherwise the input rate is taken as 25fps and frames will be duplicated to make it up to 29.97.

    ffmpeg -r 29.97 -i '%05d.png' ...
    oops, thanks!
    Quote Quote  
  8. Member
    Join Date
    Apr 2011
    Location
    Cambodia
    Search Comp PM
    I tried to look all comment and reply but I got no idea what you guy are talking about. I'm trying to make a DCP file for cinema projector. I read a toturial on this website http://bitfilms.blogspot.com/2010/11/making-dcp-entirely-with-open-source.html I got no idea what to start now. I have a Quicktime video and want to convert to PNGs using ffmpeg software but I don't know how to do. Can someone please explain me how to start???

    Inside the quote is the instruction on how to convert PNGs from QuickTime that I just copies from other website.


    Step 1: export PNGs from source QuickTime movie


    Tool: ffmpeg
    Version: SVN-r21770 (compiled locally)
    Command:
    ffmpeg -r 24 -i INMOVIE.mov -f image2 %08d.png
    This marches through the video file outputting a lossless, compressed PNG 24 times per second.
    Quote Quote  
  9. Member
    Join Date
    Apr 2011
    Location
    location, location
    Search Comp PM
    fmpeg is a command line program. So (for example) on a mac, you have to open a program called terminal and type out the command.

    If you are on a mac, you would open terminal (which you will find in the applications / utilities) and then type


    ffmpeg -r 24 -i INMOVIE.mov -f image2 %08d.png

    you must replace the word "INMOVIE.mov" with the actual name of your .mov. And it's path. So if I had a mov on my desktop that I wanted to make png's of it, I would do do this in the terminal, pretending that the name of my .mov is SOMEMOVIE.MOV and my home folder is called VIDGEM

    ffmpeg -r 24 -i /Users/vidgem/Desktop/SOMEMOVIE.MOV -f image2 %08d.png

    it will then split out your mov into pngs.
    Last edited by vidgem; 8th Nov 2011 at 23:47.
    Quote Quote  
  10. Member
    Join Date
    Apr 2011
    Location
    Cambodia
    Search Comp PM
    Thank you very much vidgem for your replied. Now I got the idea what to start

    But one more thing I'm on PC I don't have a MAC. Any chance to get it run on PC or not?


    Thanks again for your help.
    Quote Quote  
  11. Member
    Join Date
    Apr 2011
    Location
    location, location
    Search Comp PM
    I'm sure you can, you must be able to do it from the command prompt maybe, but I don't know. you will have to google for the answer.

    I think there will be easier programs for what you want to achieve, but with a bit of work ffmpeg can do the trick.
    Quote Quote  
  12. Member
    Join Date
    Apr 2011
    Location
    Cambodia
    Search Comp PM
    Many thanks for your time.
    Quote Quote  
  13. Member
    Join Date
    Apr 2011
    Location
    Cambodia
    Search Comp PM
    My dear Vidgem,

    So far I got it run on VMWare MAC OSX Snow Leopard now but it seem that I still have some problem. Because I can not see the output files.

    I'm not sure what the exact problem is but I think it is problem with my input video. Can you help me please?

    below is the screenshot of my terminal after finished encording.

    Thanks for your time.

    Image
    [Attachment 9616 - Click to enlarge]
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!