Re: [Mjpeg-users] mpeg2enc 1.6.2: how to use -p for 24fps source?
On 14/12/2005, at 4:21 PM, Trent Piepho wrote: When you use -F 4 -p, the mpeg file has its framerate set to 30 fps, but there are only 24 frames encoded per second. The encoder puts in repeat field flags that tell the decoder to do the pulldown, which has the effect of converting 24 frames into 30 frames. So it's more correct to say that the decoder contructs 3:1001 video from a 24000:1001 source, as opposed to the other way around. I am guessing that these repeat field flags are not to difficult to add to a stream. As this program can modify an existing m2v stream http://www.inwards.com/inwards/?id=36 (source is available and will compile on OSs other than windows) And I am also guessing that the repeat field flags are distinct enough for players, such as mplayer, to say, hey this is really a 23.976 progressive steram, I'll play it as such. I've seen mpeg files that swap between 29.97 and 23.976 with pulldown. Some of the video is in 23.976 progressive and some is 29.97 interlaced, mplayer can detect these changes and will change it's playback mid stream. I guess my confusion is, that the resulting mpeg stream is a fully compliant 29.97 interlaced stream, and is played as such by players that don't know about pull down, but these repeat field flags can be added, detected and removed easily. I don't quite understand. Mark --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users
Re: [Mjpeg-users] mpeg2enc 1.6.2: how to use -p for 24fps source?
The easy way to understand all this is that the -F flag specifies the rate at which the decoder outputs *decoded images* for display. This is not always the same as the rate at which encode images arrive and are decoded because of the 3:2 pulldown to display 24Hz Movie material for display on 60Hz interlaced TV equipment. Here frames arrive and are decoded at (on average) 24 frames/sec. However alternate decoded images are displayed for 2/2 frame or 3/2 frame intervals. Whats going out across the video cable to the TV is: Frame 0: TBT Frame 1: BT Frame 2: BTB Frame 3: TB Where T is the top field (even lines of frame) and B is bottom field (odd lines of frame). I guess my confusion is, that the resulting mpeg stream is a fully compliant 29.97 interlaced stream, and is played as such by players that don't know about pull down, but these repeat field flags can be added, detected and removed easily. I don't quite understand. The point is the compressed MPEG stream is (on average) 24000/1001 Hz. The video stream produced by the MPEG decoder is 3/1001Hz. The -F flag sets what the encoder tells the decoder the rate *decoded images* should be output rate should be. Hence, the correct combination for 30ish-Hz 3:2 pulldown playback of 24Hz 'Movie' material is -F 4 -p! If you want to play 24Hz material at 24Hz you want -F 1 (and no -p). Aside: on a 'progressive' DVD player and TV all that happens is that for each T or B both T *and* B are sent.If you have a good progressive TV the motion judder that results from this process is correct by some really fancy real-time motion-compensated estimation of what the frame would have looked like at an even playback rate! And I am also guessing that the repeat field flags are distinct enough for players, such as mplayer, to say, hey this is really a 23.976 progressive steram, I'll play it as such. I've seen mpeg files that swap between 29.97 and 23.976 with pulldown. Some of the video is in 23.976 progressive and some is 29.97 interlaced, mplayer can detect these changes and will change it's playback mid stream. Each coded picture literally has a couple of bits in its header which tell the decoder which of the four output patterns should be used. Hence it is possible to switch between 3:2 pulldown display of 24Hz material to 'normal' display of 30Hz material literally from frame to frame. Actually, it can even be done field-to-field. MPEG is very flexible in this regard. To make a completely correct MPEG stream some other bits in sequence headers may also need to be adjusted. The multiplexing process additionally uses the bits to generate decode and display timestamps for each picture that codes essentially the same information. Some players use the time stamps some use the bits to decide what to do frame-by-frame. Andrew --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users
[Mjpeg-users] mpeg2enc 1.6.2: how to use -p for 24fps source?
Hi! I have a DV stream that I'm trying to encode for DVD. I have an NTSC DV camera, and it shoots in 3/1001. I can encode it perfectly well into 3:1001 MPEG-2. As an experiment, I wanted to make a 24000/1001 encoding (I didn't really care about the output quality, I just was curious). When I encode, I use mplayer to pipe the video's yuv stream to a named fifo (stream.yuv). While that is going on the background, I cat the fifo through yuv2fps and then to mpeg2enc. After reading mpeg2enc's man page, I decided that changing -F 4 to -F 1 and adding -p would work. However, I was wrong and mpeg2enc changed the frame rate number to 4 (3/1001) when it started. The man page gave me the impression that -p would work for 24fps _source_ material and tell the decoder to do pulldown at playtime. yuv2fps changed the framerate to 24000/1001, but mpeg2enc still encoded at 3/1001. By removing -p, I got things to work and mpeg2enc kept the source's 24000:1001 frame rate. What am I not understanding about using -p? Thanks, Joe From mpeg2enc's man page: -F|--frame-rate num Set the frame-rate of the output-stream. By default, this value is inferred from the input header. Currently only the standard MPEG rates are supported. Eventually more-or-less arbitrary rates will be possible. 0 - illegal 1 - 24000.0/1001.0 (NTSC 3:2 pulldown converted FILM) 2 - 24.0 (NATIVE FILM) 3 - 25.0 (PAL/SECAM VIDEO / converted FILM) 4 - 3.0/1001.0 (NTSC VIDEO) 5 - 30.0 6 - 50.0 (PAL FIELD RATE) 7 - 6.0/1001.0 (NTSC FIELD RATE) 8 - 60.0 -p|--3-2-pulldown Setting -p only makes sense for 24frame/sec Movie source material. It sets flags in the output stream that tell the decoder to play the movie as NTSC 60field/sec video using 3:2 pulldown. This is vastly more efficient than encoding as 60field/sec video. The classic application is to transcode a PAL-encoded movie (24fps played too fast at 25 fps!) into NTSC (see the -f flag). Doesn't work: cat stream.yuv | yuvfps -r 24000:1001 -v 1 | nice -n 0 mpeg2enc -S 4500 -B 304 -a 2 -f 8 -b 7840 -g 4 -G 9 -D 10 -F 1 -p -v 1 -n n -4 2 -2 1 -q 5 -H -o ntscfilm-test.m2v result: INFO: [yuvfps] yuv2fps (version 0.1) is a general frame resampling utility for yuv streams INFO: [yuvfps] (C) 2002 Alfonso Garcia-Patino Barbolani [EMAIL PROTECTED] INFO: [yuvfps] yuvfps -h for help, or man yuvfps ++ WARN: [yuvfps] Original framerate: 29970029:100, Normalized framerate: 3:1001 ++ WARN: [yuvfps] Converting from 3:1001 to 24000:1001 INFO: [mpeg2enc] SETTING EXTENDED MMX for MOTION! INFO: [mpeg2enc] SETTING MMX for TRANSFORM! INFO: [mpeg2enc] SETTING EXTENDED MMX for PREDICTION! INFO: [mpeg2enc] Selecting DVD output profile INFO: [mpeg2enc] Progressive input - selecting progressive encoding. ++ WARN: [mpeg2enc] 3:2 movie pulldown with frame rate set to decode rate not display rate ++ WARN: [mpeg2enc] 3:2 Setting frame rate code to display rate = 4 (29.970 fps) INFO: [mpeg2enc] Encoding MPEG-2 video to ntscfilm-test.m2v INFO: [mpeg2enc] Horizontal size: 720 pel INFO: [mpeg2enc] Vertical size: 480 pel INFO: [mpeg2enc] Aspect ratio code: 2 = 4:3 display INFO: [mpeg2enc] Frame rate code: 4 = 3.0/1001.0 (NTSC VIDEO) INFO: [mpeg2enc] Bitrate: 7840 KBit/s INFO: [mpeg2enc] Quality factor: 5 (Quantisation = 5) (1=best, 31=worst) INFO: [mpeg2enc] Field order for input: none/progressive INFO: [mpeg2enc] New Sequence every 4500 Mbytes INFO: [mpeg2enc] Assuming non-video stream of 304 Kbps INFO: [mpeg2enc] Search radius: 16 INFO: [mpeg2enc] GOP SIZE RANGE 4 TO 9 INFO: [mpeg2enc] Setting colour/gamma parameters to NTSC INFO: [mpeg2enc] Progressive format frames = 1 INFO: [mpeg2enc] 3:2 Pulldown selected frame decode rate = 23.976 fps INFO: [mpeg2enc] Setting hi-res intra Quantisation matrix INFO: [mpeg2enc] Buffering 21 frames Works: cat stream.yuv | yuvfps -r 24000:1001 -v 1 | nice -n 0 mpeg2enc -S 4500 -B 304 -a 2 -f 8 -b 7840 -g 4 -G 9 -D 10 -F 1 -v 1 -n n -4 2 -2 1 -q 5 -H -o ntscfilm-test-no-p.m2v result: INFO: [yuvfps] yuv2fps (version 0.1) is a general frame resampling utility for yuv streams INFO: [yuvfps] (C) 2002 Alfonso Garcia-Patino Barbolani [EMAIL PROTECTED] INFO: [yuvfps] yuvfps -h for help, or man yuvfps ++ WARN: [yuvfps] Original framerate: 29970029:100, Normalized framerate: 3:1001 ++ WARN: [yuvfps] Converting from 3:1001 to 24000:1001 INFO: [mpeg2enc] SETTING EXTENDED MMX for MOTION! INFO: [mpeg2enc] SETTING MMX for TRANSFORM! INFO: [mpeg2enc] SETTING EXTENDED MMX for PREDICTION! INFO: [mpeg2enc] Selecting DVD output profile INFO: [mpeg2enc] Progressive input - selecting
Re: [Mjpeg-users] mpeg2enc 1.6.2: how to use -p for 24fps source?
So, if I have 24000:1001 material and I want to encode for NTSC DVD, I need to specify -F 4 -p (not -F 1 -p). This way, the encoded file has a DVD-compliant frame rate (3:1001) with the proper MPEG flag telling the decoder to do pulldown (to reconstruct the 24000:1001 video from the encoded 3:1001) at play time. When you use -F 4 -p, the mpeg file has its framerate set to 30 fps, but there are only 24 frames encoded per second. The encoder puts in repeat field flags that tell the decoder to do the pulldown, which has the effect of converting 24 frames into 30 frames. So it's more correct to say that the decoder contructs 3:1001 video from a 24000:1001 source, as opposed to the other way around. --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click ___ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users