Hello, I've got a h264 video stream and a AC3 audio stream, together in a TS container. The streams were recorded from a German HD TV channel and I'd like to copy the video stream unmodified and the audio stream recoded as AAC to a mp4 container.
In short, everything works fine if the source video features linearly ascending timestamps. If not, av_interleaved_write_frame fails due to "error, non monotone timestamps". The following lines are showing the first 25 pts and dts values of the video stream, which I get when grabbing frame after frame from the source file (the values are already adjusted with an offset to start at 0): Video frame pts=0 dts=0 keyfr=1 len=95761 Video frame pts=10800 dts=3600 keyfr=0 len=50521 Video frame pts=3600 dts=7200 keyfr=0 len=17406 Video frame pts=7200 dts=10800 keyfr=0 len=18577 Video frame pts=21600 dts=14400 keyfr=0 len=73589 Video frame pts=14400 dts=18000 keyfr=0 len=25470 Video frame pts=18000 dts=21600 keyfr=0 len=28693 Video frame pts=32400 dts=25200 keyfr=0 len=85189 Video frame pts=25200 dts=28800 keyfr=0 len=25051 Video frame pts=28800 dts=32400 keyfr=0 len=33260 Video frame pts=43200 dts=36000 keyfr=0 len=82121 Video frame pts=36000 dts=39600 keyfr=0 len=28684 Video frame pts=39600 dts=43200 keyfr=0 len=27044 Video frame pts=54000 dts=46800 keyfr=0 len=87616 Video frame pts=46800 dts=50400 keyfr=0 len=27214 Video frame pts=50400 dts=54000 keyfr=0 len=32775 Video frame pts=64800 dts=57600 keyfr=0 len=89310 Video frame pts=57600 dts=61200 keyfr=0 len=27987 Video frame pts=61200 dts=64800 keyfr=0 len=33918 Video frame pts=75600 dts=68400 keyfr=0 len=89860 Video frame pts=68400 dts=72000 keyfr=0 len=27960 Video frame pts=72000 dts=75600 keyfr=0 len=34241 Video frame pts=86400 dts=79200 keyfr=0 len=95234 Video frame pts=79200 dts=82800 keyfr=0 len=27338 Video frame pts=82800 dts=86400 keyfr=0 len=36018 Obviously, the pts values are jumping around and sometimes they are actually before the dts values, which really is no good ;) I'm not the big video guru but I guess these values are the result of B-frames in the pyramid mode supported by h264. Therefore the source file plays fine in different media players including those using ffmpeg and CoreAVC libraries. My first try was to emulate the timestamps with linearly ascending values. This resulted in a playable but asynchronous file. The second try used the AVFMT_NOTIMESTAMPS flag of the AVFormatContext. This time the result had perfectly synchronised video & audio but the drawn video was broken at (at least my guess) B-frame-level. Upon every move in the scene various blocks appear around the borders of moving and not moving areas. Anyone got a clue how to handle this? Regards Andre _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
