Good audio sync AND no buffer underflows
It took a lot of testing, sheesh. But finally...
The following resulted in good quality video and no underflow errors, but audio sync was way off (video lagged):
# ffmpeg -y -i /mythtv/finland_px.m2v -r ntsc -target dvd
-b 3000 -s 720x480 -copyts -aspect 16:9 /mythtv/finland_ff_px.mpg
Problem is that duration of show is incorrect!
Input #0, mpegvideo, from '/mythtv/finland_px.m2v':
Duration: 01:40:23.6, start: 0.000000, bitrate: 8999 kb/s
Stream #0.0, 29.97 fps(r): Video: mpeg2video, yuv420p, 1920x1080, 9000 kb/s
Assuming NTSC for target.
Output #0, dvd, to '/mythtv/finland_ff-deinterlaced_px.mpg':
Stream #0.0, 29.97 fps(c): Video: mpeg2video, yuv420p, 720x480, q=2-31, 3000 kb
/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
ffmpeg reports that duration is "Duration: 01:40:23.6" which is not correct for this 1 hour show. Perhaps ProjectX is miscalculating the length of the video, and note that bitrate is capped at 8999. This explains why video was lagging badly, it was playing 1hr of video over a period of 1:40:23! Slooooooow....
mplayer agrees that length is 01:40:
# mplayer -vo dummy -ao dummy -identify finland_px.m2v 2>&1
Playing finland_px.m2v.
MPEG-ES file format detected.
ID_VIDEO_ID=0
VIDEO: MPEG2 1920x1080 (aspect 3) 29.970 fps 9000.0 kbps (1125.0 kbyte/s)
ID_FILENAME=finland_px.m2v
ID_VIDEO_FORMAT=0x10000002
ID_VIDEO_BITRATE=9000000
ID_VIDEO_WIDTH=1920
ID_VIDEO_HEIGHT=1080
ID_VIDEO_FPS=29.970
ID_VIDEO_ASPECT=1.7778
ID_LENGTH=6023
6023/60 is 100.38m = 1hr 40m 23s! This means ProjectX is putting wrong duration in the m2v file. Maybe we can hexedit the value in the file somewhere? Maybe there's more PX command line options to try? Who knows.
Also note "Input #0, mpegvideo", which differs from "Input #0, mpeg" in the hdtvtompeg2 example below.
UPDATE: Found this on myth-users (will try next):
> don't demux with projectX, it has problems with its demux code and
> theres really no reason to demux with it, just output with --tom2p
> which will output a PS stream with proper audio sync.
UPDATE2: -tom2p option works. When feeding px .m2p to ffmpeg, ffmpeg now reports correct duration and bitrate:
Input #0, mpeg, from 'finland_px-tom2p.m2p':
Duration: 00:58:54.7, start: 38287.531567, bitrate: 16765 kb/s
Stream #0.0[0x1e0], 29.97 fps(r): Video: mpeg2video, yuv420p, 1920x1080, 65000 kb/s
Next try using hdtvtompeg2 file as the source file. This time duration is correct (00:58:36). Note, audio processing is done simultaneously so there's no muxing later:
# ffmpeg -y -i /mnt/finland.0000.mpg -t 600 -r ntsc -target dvd
-b 3000 -s 720x480 -deinterlace -copyts -aspect 16:9
-acodec copy /mythtv/fin-ff-h2m.mpg
(-t 600 for a 10min test clip)
Input #0, mpeg, from '/mnt/finland.0000.mpg':
Duration: 00:58:36.6, start: 31022.294233, bitrate: 17116 kb/s
Stream #0.0[0x1e0], 29.97 fps(r): Video: mpeg2video, yuv420p, 1920x1080, 65000
kb/s
Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5 channels, 384 kb/s
Assuming NTSC for target.
Output #0, dvd, to '/mythtv/fin-ff-h2m.mpg':
Stream #0.0, 29.97 fps(c): Video: mpeg2video, yuv420p, 720x480, q=2-31, 3000 kb
/s
Stream #0.1: Audio: ac3, 48000 Hz, 5 channels, 384 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
Note how bitrate is now much higher (17116 kbps, and 65000 kbps). This is likely the correct bitrate. And in fact, it worked. Audio/video sync was perfect.
Maybe there's a way to use the -b option with -i (the input file). Maybe force format to mpeg instead of 'mpegvideo' with -f mpeg?
-f mpeg did not work with PX m2v file:
[root@be mythtv]# ffmpeg -y -f mpeg -i /mythtv/finland_px.m2v -r ntsc -target dvd
-b 3000 -s 720x480 -copyts -aspect 16:9 /mythtv/finland_force_ff_px.mpg
FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
libavutil version: 49.0.0
libavcodec version: 51.7.0
libavformat version: 50.3.0
built on Mar 1 2006 06:18:11, gcc: 3.4.4 20050721 (Red Hat 3.4.4-2)
Input #0, mpeg, from '/mythtv/finland_px.m2v':
Duration: N/A, bitrate: N/A
Assuming NTSC for target.
No audio or video streams available
-b 65000 did not work on m2v file:
ffmpeg -y -b 65000 -i /mythtv/finland_px.m2v -t 60 -r ntsc ...
"Duration: 01:40:23.6, start: 0.000000, bitrate: 8999 kb/s"
0 Comments:
Post a Comment
<< Home