View Full Version : Comparison of two converted avi files
David1105
2nd June 2007, 02:36
My goal is to keep the output avi lossless with regards to the input file and preserving its info...Thus I picked the switch "-vcodec mjpeg" as in the Commandline 1.
Using ffmpeg and the command lines are:
Commandline 1: ffmpeg -i input.mov -y -f avi -vcodec mjpeg -s 320x180 -acodec mp3 output1.avi
Commandline 2: ffmpeg -i input.mov -y -f avi -s 320x180 output2.avi
The input file is the same mov but the outputs are: output1.avi and output2.avi.
The quality of output1.avi is obviously lower than that of Output2. Then it means that Commandline 1 is NOT lossless.
What reasons could cause the problem?
For Commandline 2, if not specifying vcodec, which codec will be picked for video?
Thanks!
foxyshadis
2nd June 2007, 08:01
Mjpeg isn't meant to be lossless. ljpeg is close enough, however. (ljpeg is just mjpeg with q=1 and some tweaks.)
Can you just use vcodec copy though, which I think the second is using anyway? Keeping the original is always faster and higher quality anyway.
David1105
3rd June 2007, 20:58
Mjpeg isn't meant to be lossless. ljpeg is close enough, however. (ljpeg is just mjpeg with q=1 and some tweaks.).
By "ljpeg is close", do you mean still some loss involved?
Can you just use vcodec copy though, which I think the second is using anyway? Keeping the original is always faster and higher quality anyway.
Are you saying Commandline 2 is the so-called "vcodec copy though"?
Does "vcodec copy though" use whichever default vcodec for conversion? Is there any loss at all?
J_Darnley
4th June 2007, 17:45
-vcodec copy will copy the input video stream straight through without any change. If you specify a resize, or other transform/filter, it will use the same format but re-encode the video.
With a slightly modified input of your command line 2 ffmpeg used:
D:\AviSynth>ffmpeg -i x264_testing.avs -y -f avi -s 320x180 output2.avi
...
Input #0, avs, from 'x264_testing.avs':
Duration: 00:12:42.0, start: 0.000000, bitrate: 0 kb/s
Stream #0.0: Video: rawvideo, yuv420p, 704x288, 60825 kb/s, 25.00 fps(r)
Output #0, avi, to 'output2.avi':
Stream #0.0: Video: mpeg4, yuv420p, 320x180, q=2-31, 200 kb/s, 25.00 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1996 fps= 90 q=8.4 Lsize= 2113kB time=79.8 bitrate= 216.8kbits/s
video:2060kB audio:0kB global headers:0kB muxing overhead 2.591336%
Received signal 2: terminating.
So it appears to use mpeg4 when not given a -vcodec parameter. Upon closer inspection the output avi has a fourCC of FMP4 and very basic mpeg4 tools leading to a very poor picture. <goes on to rant about what I would expect for 200 kbit/s ...>
If you want a lossless output you will need to use a lossless codec. The ones I know ffmpeg supports are huffyuv, ffv1 and zlib. You should be able to play back those three with FFDShow. If you have problems with them you can just always use rawvideo which, as the name suggests, output raw video to a rather large file. If your video clips aren't too long you could easily use this. The output stream will be roughly 2 Mbit/s or 120 MiB mer minute.
foxyshadis
5th June 2007, 06:36
Of course you can't copy the video stream when you're resizing, what was I thinking.
ljpeg has very slight losses - perceptually lossless, and shouldn't affect any editing unless you re-encode it tons of times before the final product. xvid and x264 (at q1) are similar, although both need some extra settings to be useful as editing codecs.
For true lossless there's also png, zmbv, jpegls, and ffvhuff, a modified huffyuv. All are part of codec lavc and have to be activated through it, see the docs (http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-libavcodec.html#menc-feat-enc-libavcodec-video-codecs). jpegls can be both minimally lossy and true lossless, check the options for that one.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.