Index: cfg-common.h =================================================================== RCS file: /cvsroot/mplayer/main/cfg-common.h,v retrieving revision 1.133 diff -u -r1.133 cfg-common.h --- cfg-common.h 3 May 2004 13:19:03 -0000 1.133 +++ cfg-common.h 22 May 2004 02:30:41 -0000 @@ -130,6 +130,10 @@ // force video/audio rate: {"fps", &force_fps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL}, + // set output framerate - recommended when encoding variable-FPS + // (ASF etc) files and for 29.97FPS progressive MPEG2 streams or + // when playing a file directly with inverse telecine/divtc. + {"ofps", &force_ofps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL}, {"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL}, {"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 1, 6, NULL}, {"format", &audio_output_format, CONF_TYPE_INT, CONF_RANGE, 0, 0x00002000, NULL}, Index: cfg-mencoder.h =================================================================== RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v retrieving revision 1.87 diff -u -r1.87 cfg-mencoder.h --- cfg-mencoder.h 19 May 2004 04:33:00 -0000 1.87 +++ cfg-mencoder.h 22 May 2004 02:30:41 -0000 @@ -173,9 +173,6 @@ {"endpos", parse_end_at, CONF_TYPE_FUNC_PARAM, 0, 0, 0, NULL}, - // set output framerate - recommended for variable-FPS (ASF etc) files - // and for 29.97FPS progressive MPEG2 streams - {"ofps", &force_ofps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL}, {"o", &out_filename, CONF_TYPE_STRING, 0, 0, 0, NULL}, // limit number of skippable frames after a non-skipped one Index: mplayer.c =================================================================== RCS file: /cvsroot/mplayer/main/mplayer.c,v retrieving revision 1.755 diff -u -r1.755 mplayer.c --- mplayer.c 30 Apr 2004 20:05:54 -0000 1.755 +++ mplayer.c 22 May 2004 02:30:43 -0000 @@ -272,6 +272,9 @@ static int softsleep=0; float force_fps=0; + float force_ofps=0; + float force_frame_time=0; + double v_timer_corr = 0; static int force_srate=0; static int audio_output_format=0; int frame_dropping=0; // option 0=no drop 1= drop vo 2= drop decode @@ -1931,6 +1934,9 @@ mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_FPSforced,sh_video->fps,sh_video->frametime); } + +if (force_ofps) force_frame_time = 1.0/force_ofps; + //==================== START PLAYING ======================= if(loop_times>1) loop_times--; else @@ -2070,8 +2076,23 @@ if(in_size<0){ eof=1; break; } if(in_size>max_framesize) max_framesize=in_size; // stats sh_video->timer+=frame_time; - if(sh_audio) sh_audio->delay-=frame_time; - time_frame+=frame_time; // for nosound + + if (force_ofps) { + v_timer_corr-=frame_time - force_frame_time; + if (v_timer_corr>=force_frame_time) { + v_timer_corr-=force_frame_time; + } else if (v_timer_corr<=-force_frame_time) { + v_timer_corr+=force_frame_time; + if (sh_audio) sh_audio->delay-=2*force_frame_time; + time_frame += 2*force_frame_time; + } else { + if (sh_audio) sh_audio->delay-=force_frame_time; + time_frame += force_frame_time; + } + } else { + if(sh_audio) sh_audio->delay-= frame_time; + time_frame+= frame_time; // for nosound + } // check for frame-drop: current_module="check_framedrop"; if(sh_audio && !d_audio->eof){ @@ -2092,6 +2113,11 @@ current_module="decode_video"; // printf("Decode! %p %d \n",start,in_size); blit_frame=decode_video(sh_video,start,in_size,drop_frame); + if (force_ofps && !blit_frame) { + if (sh_audio) sh_audio->delay+=force_frame_time; + time_frame -= force_frame_time; + v_timer_corr-=force_frame_time; + } break; } vdecode_time=video_time_usage-vdecode_time; Index: mplayer.h =================================================================== RCS file: /cvsroot/mplayer/main/mplayer.h,v retrieving revision 1.30 diff -u -r1.30 mplayer.h --- mplayer.h 7 Apr 2003 16:03:37 -0000 1.30 +++ mplayer.h 22 May 2004 02:30:43 -0000 @@ -26,6 +26,7 @@ extern float font_factor; extern float movie_aspect; extern float force_fps; +extern float force_ofps; //extern char **sub_name; extern float sub_delay; Index: DOCS/man/en/mplayer.1 =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v retrieving revision 1.592 diff -u -r1.592 mplayer.1 --- DOCS/man/en/mplayer.1 16 May 2004 11:28:27 -0000 1.592 +++ DOCS/man/en/mplayer.1 22 May 2004 02:30:45 -0000 @@ -866,6 +866,13 @@ extension is used to select demuxer. It always falls back to content-based demuxer selection. .TP +.B \-ofps +The output file/device will have different frame/\:sec than the source. +You MUST set it when encoding variable fps (asf, some mov) and progressive +(29.97fps telecined mpeg) files. +It should also be set when using an inverse telecine filter or divtc +with MPlayer. +.TP .B \-passwd (see \-user option too) (network only) Specify password for http authentication. .TP @@ -4136,11 +4143,6 @@ .PD 1 . .TP -.B \-ofps -The output file will have different frame/\:sec than the source. -You MUST set it for variable fps (asf, some mov) and progressive -(29.97fps telecined mpeg) files. -.TP .B \-ovc Encode with the given video codec. Use \-ovc help to get a list of available codecs. Index: DOCS/man/fr/mplayer.1 =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/man/fr/mplayer.1,v retrieving revision 1.72 diff -u -r1.72 mplayer.1 --- DOCS/man/fr/mplayer.1 13 Apr 2004 19:56:37 -0000 1.72 +++ DOCS/man/fr/mplayer.1 22 May 2004 02:30:47 -0000 @@ -853,6 +853,14 @@ l'extension du fichier est utilisée pour sélectionner le demuxer. Il se rabat toujours sur une sélection de demuxer basée sur le contenu. .TP +.B \-ofps +Le vidéo présenté à l'écran ou le fichier de destination a un rapport +trame/\:sec différent du fichier source. +Vous DEVEZ l'initialiser pour encoder les fichiers à fps variables +(asf, quelques mov) et progressifs (mpeg telecine à 29.97fps). +Il devrait aussi être initialisé lorsque vous utilisez un filtre inverse +telecine ou divtc avec MPlayer. +.TP .B \-passwd (voir également l'option \-user) Indique le mot de passe pour l'identification http. .TP @@ -3850,11 +3858,6 @@ .PD 1 . .TP -.B \-ofps -Le fichier de destination a un rapport trame/\:sec différent du fichier -source. Vous DEVEZ l'initialiser pour les fichiers à fps variables -(asf, quelques mov) et progressifs (mpeg telecine à 29.97fps). -.TP .B \-ovc Encode avec le codec vidéo indiqué. Utilisez \-ovc help pour avoir une liste des codecs disponibles.