Problems encoding from blu-ray m2ts
I'm trying to transcode a blu-ray m2ts file and having a devil of a time getting mencoder to work reliably. If anyone can see anything I'm doing wrong from the information below or has some suggestions I'd be very grateful. mencoder, ffmpeg and x264 are all built from snapshots only a few days old. The output from mplayer -identify was not very helpful, but ffmpeg identifies the streams as: Input #0, mpegts, from 'National Parks D2.m2ts': Duration: 02:11:24.04, start: 11.617322, bitrate: 35837 kb/s Program 1 Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 29.97 tbr, 90k tbn, 59.94 tbc Stream #0.1[0x1100]: Audio: truehd, 48000 Hz, 6 channels, s32 Stream #0.2[0x1100]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s Stream #0.3[0x1101]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0.4[0x1102]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0.5[0x1200]: Subtitle: pgssub Stream #0.6[0x1201]: Subtitle: pgssub ffmpeg is able to correctly extract any of the streams and properly transcode the truehd to ac3. Mencoder runs for a bit and dies with the dreaded "too many audio packets in the buffer" line when trying to process the truehd stream into ac3. I can't seem to get it to copy the 5.1 channel (stream 0.2 in ffmpeg) with any manner of -ausid, but with some fiddling I was able to get it to use the stereo stream (0.3) and work past the audio packet error. However, it now sometimes stops inexplicably in the middle of the encode without any any errors. Restarting with the exact same options will sometimes let it finish the pass, sometimes not. Setting the message level to all=6, this is the output just before stopping (this time) at only 66%. Commandline: mencoder -alang en -oac lavc -ovc x264 -sws 10 -aid 0x1101 -channels 2 -vf pullup,softskip,scale=-11:720:::5,unsharp=l3x3:1:c3x3:1,harddup -aspect 16/9 -lavcopts acodec=ac3:abitrate=640 -x264encopts deblock=-1,-1:qpmin=12:qpmax=30:subme=5:qcomp=0.5:partitions=i8x8,i4x4,p8x8,p4x4,b8x8:8x8dct:me=umh:bframes=3:b_pyramid=normal:trellis=2:direct=auto:level_idc=41:turbo=2:threads=4:bitrate=4126:ref=5:pass=1 -msgmodule -msglevel all=6 -o "pass1.avi" "00014.m2ts" Output before stopping short: DEMUX: PARSE_PMT(1 INDEX 3), STREAM: 3, FOUND pid=0x1102 (4354), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 10 DEMUX: PARSE_PMT(1 INDEX 4), STREAM: 4, FOUND pid=0x1200 (4608), type=0xffffffff, ES_DESCR_LENGTH: 0, bytes left: 5 DEMUX: PARSE_PMT(1 INDEX 5), STREAM: 5, FOUND pid=0x1201 (4609), type=0xffffffff, ES_DESCR_LENGTH: 0, bytes left: 0 DEMUX: ---------------------------- DEMUXER: ds_fill_buffer: EOF reached (stream: video) DEMUXER: ds_fill_buffer: EOF reached (stream: video) DEMUXER: ds_fill_buffer: EOF reached (stream: video) MENCODER: Flushing video frames. MUXER: Writing index... Error trying to encode truehd stream to ac3: Pos: 19.4s 713f ( 0%) 6.34fps Trem: 642min 6589mb A-V:0.040 [7653:640] Too many audio packets in the buffer: (4097 in 543820 bytes). Maybe you are playing a non-interleaved stream/file or the codec failed? For AVI files, try to force non-interleaved mode with the -ni option. Too many audio packets in the buffer: (4097 in 543820 bytes). Maybe you are playing a non-interleaved stream/file or the codec failed? For AVI files, try to force non-interleaved mode with the -ni option. Too many audio packets in the buffer: (4097 in 543820 bytes). Maybe you are playing a non-interleaved stream/file or the codec failed? For AVI files, try to force non-interleaved mode with the -ni option.
Wes Morgan wrote:
I'm trying to transcode a blu-ray m2ts file and having a devil of a time getting mencoder to work reliably. If anyone can see anything I'm doing wrong from the information below or has some suggestions I'd be very grateful. mencoder, ffmpeg and x264 are all built from snapshots only a few days old.
The output from mplayer -identify was not very helpful, but ffmpeg identifies the streams as:
Input #0, mpegts, from 'National Parks D2.m2ts': Duration: 02:11:24.04, start: 11.617322, bitrate: 35837 kb/s Program 1 Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 29.97 tbr, 90k tbn, 59.94 tbc Stream #0.1[0x1100]: Audio: truehd, 48000 Hz, 6 channels, s32 Stream #0.2[0x1100]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s Stream #0.3[0x1101]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0.4[0x1102]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0.5[0x1200]: Subtitle: pgssub Stream #0.6[0x1201]: Subtitle: pgssub
ffmpeg is able to correctly extract any of the streams and properly transcode the truehd to ac3. Mencoder runs for a bit and dies with the dreaded "too many audio packets in the buffer" line when trying to process the truehd stream into ac3. I can't seem to get it to copy the 5.1 channel (stream 0.2 in ffmpeg) with any manner of -ausid, but with some fiddling I was able to get it to use the stereo stream (0.3) and work past the audio packet error. However, it now sometimes stops inexplicably in the middle of the encode without any any errors. Restarting with the exact same options will sometimes let it finish the pass, sometimes not. Setting the message level to all=6, this is the output just before stopping (this time) at only 66%. You didn't say what operating system you are using. If you are using Windows, you might find some notes I made here helpful.
http://videogeek.shacknet.nu/index.php?entry=entry090204-064824 Essentially, you need a program called eac3to to demux the streams from the .m2ts file, and then you need to process the audio and video separately, and then mux the result back together at the end. Not sure if eac3to is available on other platforms or not. I mostly did this stuff on a windows machine, so YMMV.
On Sat, 28 Nov 2009, James Hastings-Trew wrote:
Wes Morgan wrote:
I'm trying to transcode a blu-ray m2ts file and having a devil of a time getting mencoder to work reliably. If anyone can see anything I'm doing wrong from the information below or has some suggestions I'd be very grateful. mencoder, ffmpeg and x264 are all built from snapshots only a few days old.
The output from mplayer -identify was not very helpful, but ffmpeg identifies the streams as:
Input #0, mpegts, from 'National Parks D2.m2ts': Duration: 02:11:24.04, start: 11.617322, bitrate: 35837 kb/s Program 1 Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 29.97 tbr, 90k tbn, 59.94 tbc Stream #0.1[0x1100]: Audio: truehd, 48000 Hz, 6 channels, s32 Stream #0.2[0x1100]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s Stream #0.3[0x1101]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0.4[0x1102]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s Stream #0.5[0x1200]: Subtitle: pgssub Stream #0.6[0x1201]: Subtitle: pgssub
ffmpeg is able to correctly extract any of the streams and properly transcode the truehd to ac3. Mencoder runs for a bit and dies with the dreaded "too many audio packets in the buffer" line when trying to process the truehd stream into ac3. I can't seem to get it to copy the 5.1 channel (stream 0.2 in ffmpeg) with any manner of -ausid, but with some fiddling I was able to get it to use the stereo stream (0.3) and work past the audio packet error. However, it now sometimes stops inexplicably in the middle of the encode without any any errors. Restarting with the exact same options will sometimes let it finish the pass, sometimes not. Setting the message level to all=6, this is the output just before stopping (this time) at only 66%. You didn't say what operating system you are using. If you are using Windows, you might find some notes I made here helpful.
http://videogeek.shacknet.nu/index.php?entry=entry090204-064824
Essentially, you need a program called eac3to to demux the streams from the .m2ts file, and then you need to process the audio and video separately, and then mux the result back together at the end. Not sure if eac3to is available on other platforms or not. I mostly did this stuff on a windows machine, so YMMV.
Thanks for the input! I'm doing all this on freebsd, although I had to use windows to rip the discs. All the files are on an ntfs paritition, so I can move them around and use eac3to to demux if necessary. ffmpeg seemed to have no problem doing it, so I'll probably try a test run with eac3to vs ffmpeg and see how the files compare. As for audio sync, I've always read that separating the audio and video is devastating to the audio sync. Logically, that only should be the case if the number of frames of the the video stream changes or the audio is truncated somehow, but I've never tested it. Have you had any problems with a/v sync? In step 3, you check the scaling with "scale=1280:-10", and use that in the final encode followed by a dsize. I thought that mencoder automatically updated the aspect ratio through both the crop and scale filters. Does the "dsize" filter correct for the slight difference in aspect ratios between 1280x544 and 1904x800 so the result is displayed properly? If not, isn't the image being ever so slightly distorted? Would it not have been better the undercrop to 1904x810 so it would scale to 1280x544 with no distortion, even though it might leave some black pixels?
Wes Morgan wrote:
Thanks for the input!
I'm doing all this on freebsd, although I had to use windows to rip the discs. All the files are on an ntfs paritition, so I can move them around and use eac3to to demux if necessary. ffmpeg seemed to have no problem doing it, so I'll probably try a test run with eac3to vs ffmpeg and see how the files compare.
As for audio sync, I've always read that separating the audio and video is devastating to the audio sync. Logically, that only should be the case if the number of frames of the the video stream changes or the audio is truncated somehow, but I've never tested it. Have you had any problems with a/v sync?
In step 3, you check the scaling with "scale=1280:-10", and use that in the final encode followed by a dsize. I thought that mencoder automatically updated the aspect ratio through both the crop and scale filters. Does the "dsize" filter correct for the slight difference in aspect ratios between 1280x544 and 1904x800 so the result is displayed properly? If not, isn't the image being ever so slightly distorted? Would it not have been better the undercrop to 1904x810 so it would scale to 1280x544 with no distortion, even though it might leave some black pixels? _______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
I have had audio sync problems ripping DVDs, but strangely never ever have I had problems with sync ripping Blu-Ray discs. I believe it is because blu-rays are generally authored "better" - the video streams don't tend to flip back and forth between framerates or have funky mid-frame editing cuts in them. Re: your notes about cropping, scaling etc - every movie is going to be different, and I was brought up with the notion that that black edge pixels are bad because they are harsh on compression and you'll waste a lot of bits encoding them - maybe that's old superstition on my part.
participants (2)
-
James Hastings-Trew -
Wes Morgan