Hello,
I am replying to myself because thanks to Michael R., I finally know what is going on and he also told me how to fix it. In mpeg2 files there are: - the sequence header with the aspect ratio and the frame size - an optional sequence_display_extension with the display size The pixels in the mpeg2 files are called samples (if I understood it correctly) and there aspect ratio is determined a value called "sample aspect ratio"; the samples don't have a dimension on their own. The sample aspect ratio is determined like this: sample aspect ratio = aspect ratio of the sequence header multiplied by the display size of the sequence_display_extension; however sometimes the frame size is used instead of the display size The file with the problem I talked about in my previous email has: - aspect ratio and frame size in the sequence headers: 4/3 and 720x576 - display size in the sequence_display_extension: 540x576 So if the display size is used, I get for the sample aspect radio (sar): sar = (4/3) * (540/576) = 1.422 Thus the 720 samples of the movie will be displayed as 720*1.422=1023.84 ≈1024 pixels on the screen. Thus the 1024/576 = 16/9 ratio displayed, which is correct as the movie has been recorded as a 16/9 movie. The same calculation by using the frame size instead of the display size will result in a 4/3 aspect ratio. The solution to fix my buggy file: patch the aspect ratio in the sequence header to 16/9 and patch the display size in the sequence_display_extension to 720x576. This way, the sample aspect ratio will be 1.422, regardless of whether the display size or the frame size is used. Here is the command to patch the display size (it is similar to the one to patch the aspect ratio that has already been given in this thread): sed -r 's/(\x00\x00\x01\xB5\x23...)\x08\x72/\1\x0B\x42/g' \ < oldfile.mpg > newfile.mpg Finally, I want to thank again Michael R. for giving me the solution to my problem and explaining all this to me. Cheers Francesco Francesco Fumanti wrote: > Hello Bernhard, > > Bernhard Moellemann wrote: >>>> Actually, I'd rather write a small tool that just sets the aspect ratio >>>> to the same value in every frame... >>> Could anybody please tell me whether in the meantime such a tool has >>> been made available for linux? Or do I still have to go the ProjektX >>> route as suggested in the corresponding thread? >> >> mencoder does this, if you specify vaspect in -mpegopts I do this for >> a long time because sometimes on TV the aspect ratio changes to early >> or to late around commercials. >> >> Something like >> >> mencoder -nocache -quiet \ >> -oac copy -ovc copy \ >> -of mpeg -ofps 25 -mpegopts vaspect=16/9 >> >> does the trick here. > > Thanks for your reply, but I still have a problem: > > > Here is the command that I used: > mencoder movieIn.mpg \ > -nocache -quiet \ > -oac copy -ovc copy \ > -of mpeg -ofps 25 -mpegopts vaspect=16/9 \ > -o movieOut.mpg > > > Here is what I get: > > When opening the original file movieIn.mpg: > - dvbcut displays the picture correctly in 16:9 format but reports 4:3 > - kaffeine distorts the picture into a 4:3 format > - mplayer distorts the picture into a 4:3 format > - vlc displays the picture correctly in 16:9 format > > When opening the file movieOut.mpg produced by mencoder: > - dvbcut reports 16:9 format but the picture is stretched in its width > as if the anamorphic change was applied two times on the picture > - kaffeine and mplayer display the picture in the correct 16:9 format > - vlc displays the picture stretched in the width as dvbcut > > > Does anybody know what is going on and what to do, in order to be sure > that it will be displayed correctly in a stand alone dvd player. > > > Thanks in advance, > > Francesco > ------------------------------------------------------------------------------ _______________________________________________ DVBCUT-user mailing list DVBCUT-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dvbcut-user