id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
383	ffmpeg SCR moves backwards in output muxed mpeg file	johnnyquid		"I am not sure where to properly post bug reports so bear with me that I also posted in the ffmpeg-users as well.  The issue was reported in Oct 2010 and fixed but the fix does not always seem to work.  See http://ffmpeg-users.933282.n4.nabble.com/FFMPEG-encoded-MPEG-2-video-causes-error-in-DVDAuthor-td2995983.html for details.  The issue is summarized below:

The following command is used to encode videos in MPEG-2 (vob) format 
for DVD authoring: 

ffmpeg -i invideo.avi -target pal-dvd -f dvd outvideo.vob 

('-target' can also be 'ntsc-dvd' or 'film-dvd') 

Video streams encoded in this manner using the latest SVN will cause the 
following error in DVDAuthor: 

'ERR:  SCR moves backwards, remultiplex input.' 

DVD authoring then stops. Demuxing the streams and using them 
individually, or remuxing them again, will make the error message 
disappear, but the resulting MPEG-2 files (m2v or vob) or DVD are 
problematic (choppy playback, no or wrong total playing time). 

This issue appeared with SVN-r25383, when the following two lines were 
added in libavformat/mpegenc.c: 

1163   if(!s->last_scr) 
1164   s->last_scr= dts; 

The current source code has changed to:

 The new code in mpegenc.c starting at line 1163 is now (but the issue still exists): 

    pts= pkt->pts; 
    dts= pkt->dts; 

    if(pts != AV_NOPTS_VALUE) pts += 2*preload; 
    if(dts != AV_NOPTS_VALUE){ 
        if(!s->last_scr) 
            s->last_scr= dts + preload; 
        dts += 2*preload; 
    } 
 

The error is shown in the below output from ffmpeg and dvdauthor:

See the ffmpeg and dvdauthor output below: 

E:\Temp\bugfiles>ffmpeg -v 9 -loglevel 99 -i ranft.m2v -itsoffset -00:00:00.775 
-i ranft.ac3 -vcodec copy -acodec copy -target ntsc-dvd -y ranft.mpg 
ffmpeg version N-31653-gfaa3381, Copyright (c) 2000-2011 the FFmpeg developers 
  built on Jul 28 2011 01:57:12 with gcc 4.6.1 
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable- 
runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo 
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm -- 
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger 
 --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl 
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib 
  libavutil    51. 11. 0 / 51. 11. 0 
  libavcodec   53.  9. 0 / 53.  9. 0 
  libavformat  53.  6. 0 / 53.  6. 0 
  libavdevice  53.  2. 0 / 53.  2. 0 
  libavfilter   2. 27. 3 /  2. 27. 3 
  libswscale    2.  0. 0 /  2.  0. 0 
  libpostproc  51.  2. 0 / 51.  2. 0 
[mpegvideo @ 01F2B5C0] Format mpegvideo probed with size=32768 and score=51 
[mpeg1video @ 02000260] Unsupported bit depth: 0 
[mpegvideo @ 01F2B5C0] max_analyze_duration 5000000 reached at 5005000 
[mpegvideo @ 01F2B5C0] Estimating duration from bitrate, this may be inaccurate 
Input #0, mpegvideo, from 'ranft.m2v': 
  Duration: 00:00:08.88, bitrate: 8999 kb/s 
    Stream #0.0, 152, 1/1200000: Video: mpeg2video (Main), yuv420p, 720x480 [PAR 
 32:27 DAR 16:9], 1001/60000, 9000 kb/s, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 
tbc 
[ac3 @ 01F2F720] Format ac3 probed with size=8192 and score=51 
[ac3 @ 01F297A0] Unsupported bit depth: 0 
[ac3 @ 01F2F720] max_analyze_duration 5000000 reached at 5024000 
[ac3 @ 01F2F720] Estimating duration from bitrate, this may be inaccurate 
Input #1, ac3, from 'ranft.ac3': 
  Duration: 00:00:20.83, start: 0.000000, bitrate: 384 kb/s 
    Stream #1.0, 159, 1/90000: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s 
Output #0, dvd, to 'ranft.mpg': 
  Metadata: 
    encoder         : Lavf53.6.0 
    Stream #0.0, 0, 1/90000: Video: mpeg2video, yuv420p, 720x480 [PAR 32:27 DAR 
16:9], 1001/30000, q=2-31, 9000 kb/s, 90k tbn, 29.97 tbc 
    Stream #0.1, 0, 1/90000: Audio: ac3, 48000 Hz, 5.1, 384 kb/s 
Stream mapping: 
  Stream #0.0 -> #0.0 
  Stream #1.0 -> #0.1 
Press [q] to stop, [?] for help 
frame=  573 fps=  0 q=-1.0 Lsize=   10882kB time=00:00:19.11 bitrate=4662.6kbits 
/s 
video:9766kB audio:977kB global headers:0kB muxing overhead 1.301527% 

E:\Temp\bugfiles>E:\Temp\bugfiles>dvdauthor.exe -o dvdtest -x dvd.xml 
DVDAuthor::dvdauthor, version 0.6.18. 
Build options: gnugetopt iconv freetype fribidi 
Send bugs to <dvdauthor-users@lists.sourceforge.net>

INFO: dvdauthor creating VTS 
STAT: Picking VTS 01 

STAT: Processing e:\temp\bugfiles\ranft.mpg... 
ERR: SCR moves backwards, remultiplex input: 23131 < 8589910134 

E:\Temp\bugfiles> "	defect	closed	normal	FFmpeg	unspecified	fixed	mpegps				1	0
