[FFmpeg-user] Save webcam stream in mpg, not avi format

Felix Baier felixbaier at yahoo.de
Tue Aug 4 20:36:21 CEST 2015

Thanks a lot for your reply!

>> …but I’m having trouble saving in .mpg format. The reason 
>> why I would like to save in .mpg format is that
>> (1) .avi files are very large 
> This is wrong and indicates that you don't know what you 
> are talking about. This is generally no problem (that's 
> why you ask here) but in the context of your question, it 
> makes it very difficult to answer…
I should clarify: The avi files that I produce with my current code are very large.

>> and (2) my downstream analysis requires .mpg format.
> Could you elaborate?
Actually, the downstream analysis (Ethovision, a behavioral analysis program) will either take mpg OR avi as input container. The reason why I currently work with mpg is that my avi output files are very large, but when I convert them to mpg with a file converter software, they are much smaller. That doesn’t mean I’m set on mpg — if I could modify my code to make the avi files smaller, that would do the trick. If I understand correctly, the codec, not the container, determines file size. Thus, is it possible to save in avi format, but use a different codec that will generate smaller files?

> mpg (MPEG program streams) are among the few containers 
> that are slightly more difficult to use (create) because 
> additional constraints are generally necessary ("mpg" is 
> not enough), see also FFmpeg's output:
>> VBV buffer size not set, using default size of 130KB
>> If you want the mpeg file to be compliant to some 
>> specification Like DVD, VCD or others, make sure you 
>> set the correct buffer size
> If you don't know the difference between container and 
> codec (the codec is the reason for "files being very 
> large"), now is a good time to find out using Google 
> and / or Wikipedia.
Based on what you said, it seems to me that I have two options: (1) save in avi, but use different codec to reduce file size, (2) save in mpg, but convert rawvideo. Is this correct? And do you have a suggestion for option 1?

>>    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360
> You cannot put rawvideo in mpg (neither program nor 
> transport stream), the resulting file will be invalid.
> This is not a limitation of FFmpeg, but the MPEG 
> specifications.
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list