VideoHelp Forum




+ Reply to Thread
Results 1 to 28 of 28
  1. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    I am trying to optimize the speed of my re-encodes of HD MPEG2 captures. Really, I am doing very little to these videos. I cut the commercials with VideoRedo, and then process them back to 23.976fps and hardcode the captions.

    I am trying to understand the speed differences between re-encoding 720p material and 1080i material.

    720p clip avs:
    Code:
    MPEG2Source("video.d2v")
    SelectEven()
    TDecimate()
    Undot()
    TextSub("video.srt")
    fps = 15.8

    1080i clip avs (resizing to 1280x720):
    Code:
    MPEG2Source("video2.d2v")
    TFM()
    TDecimate()
    Undot()
    Lanczosresize(1280, 720)
    TextSub("video2.srt")
    fps = 6.6

    If I drop the TFM() [yes, I know...I don't want to do this just trying to track down fps delta]

    fps = 9.9

    These numbers are on my dual core laptop. On my quadcore, the difference is even greater (~50fps 720p to ~13 fps 1080i).

    Is it the decoding speed of 1080i material compared with the smaller framesize of 720p? On my quadcore, the cpu utilization for the 720p re-encode is ~60-70% whereas the 1080i material is ~30-35%. It seems like it is decode limited, but I am not sure. Could I maybe benefit from using MTsource? I tried using FFMPEGSource2 (-mt version) instead of MPEG2Source, but I didn't note any speed differences.
    Quote Quote  
  2. There are a couple of major reasons for the differences in encode speed. The 1080i one contains over twice the pixel count of the 720p one. Any filtering will take over twice as long. And field matching (TFM) is a lot more CPU intensive than is a SelectEven(). You can speed up the 1080i filtering in a couple of ways. One is to remove the post-processor if possible (go over it carefully before encoding as it's not always a good idea), the other is to resize in the horizontal direction before the IVTC:

    MPEG2Source("video2.d2v")
    LanczosResize(1280,Height)
    TFM(PP=0)
    TDecimate()
    LanczosResize(Width,720)
    Undot()
    TextSub("video2.srt")
    Quote Quote  
  3. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    Originally Posted by txporter View Post
    I am trying to optimize the speed of my re-encodes of HD MPEG2 captures. Really, I am doing very little to these videos. I cut the commercials with VideoRedo, and then process them back to 23.976fps and hardcode the captions.
    ...
    Once you do that, you can fit 44+ minutes to a DVD-5 or a movie to DVD-9. I usually stop there with no re-encode.
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  4. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Originally Posted by manono View Post
    There are a couple of major reasons for the differences in encode speed. The 1080i one contains over twice the pixel count of the 720p one. Any filtering will take over twice as long. And field matching (TFM) is a lot more CPU intensive than is a SelectEven(). You can speed up the 1080i filtering in a couple of ways. One is to remove the post-processor if possible (go over it carefully before encoding as it's not always a good idea), the other is to resize in the horizontal direction before the IVTC:

    MPEG2Source("video2.d2v")
    LanczosResize(1280,Height)
    TFM(PP=0)
    TDecimate()
    LanczosResize(Width,720)
    Undot()
    TextSub("video2.srt")
    Thanks, manono. That is pretty much what I was expecting. Is there any drawback to resize width in one step and then height in another?

    Originally Posted by edDV View Post
    Originally Posted by txporter View Post
    I am trying to optimize the speed of my re-encodes of HD MPEG2 captures. Really, I am doing very little to these videos. I cut the commercials with VideoRedo, and then process them back to 23.976fps and hardcode the captions.
    ...
    Once you do that, you can fit 44+ minutes to a DVD-5 or a movie to DVD-9. I usually stop there with no re-encode.
    Are you saying that you process the videos back to 23.976fps without re-encoding? How is this done? Do closed captions stay in sync if you do this?
    Quote Quote  
  5. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    Originally Posted by txporter View Post
    Originally Posted by edDV View Post
    Originally Posted by txporter View Post
    I am trying to optimize the speed of my re-encodes of HD MPEG2 captures. Really, I am doing very little to these videos. I cut the commercials with VideoRedo, and then process them back to 23.976fps and hardcode the captions.
    ...
    Once you do that, you can fit 44+ minutes to a DVD-5 or a movie to DVD-9. I usually stop there with no re-encode.
    Are you saying that you process the videos back to 23.976fps without re-encoding? How is this done? Do closed captions stay in sync if you do this?
    Cut commercials on I frames or with Womble. Then inverse telecine the segments, then append. No re-encoding except inside the transition GOP if Womble is used.

    I don't use the captions much so I'd have to check. I'd expect an IVTC to affect caption sync.
    Last edited by edDV; 4th Mar 2010 at 12:34.
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  6. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Originally Posted by edDV View Post
    Cut commercials on I frames or with Womble. Then inverse telecine the segaments, then append. No re-encoding except inside the transition GOP if Womble is used.
    Dang. I need VideoRedo and Womble to team up. Don't think I am going to drop another $100 on video editing software. Do you know how exactly Womble is able to strip the dup frames without re-encoding? I haven't seen any other software that does that.
    Quote Quote  
  7. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    Originally Posted by txporter View Post
    Originally Posted by edDV View Post
    Cut commercials on I frames or with Womble. Then inverse telecine the segaments, then append. No re-encoding except inside the transition GOP if Womble is used.
    Dang. I need VideoRedo and Womble to team up. Don't think I am going to drop another $100 on video editing software. Do you know how exactly Womble is able to strip the dup frames without re-encoding? I haven't seen any other software that does that.
    No, I just use Womble to cut out commercials when I want frame accurate cuts. Womble doesn't inverse telecine. It just cuts or adds simple transitions. It's fine for MPeg2 (telecine) to MPeg2 (telecine) where the DVD player or HDTV do the inverse telecine.

    If I don't need frame accuracy, I just use a TS/PS cutter like HDTVtoMPeg2 (I frame half second accuracy). The captions follow.

    Come to think about it, when I inverse telecine in Virtualdub or AVIsynth, it is a recode if I go back to MPeg2. Might as well go for h.264.
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  8. Member Abas-Avara's Avatar
    Join Date
    Aug 2009
    Location
    Azerbaijan
    Search Comp PM
    Try MPEG2cut, it doesnt re-encode if you only cut the commercials.
    It's also free.

    About the sub, better to not hard code, VLC just supports subtitles.
    The flag once raised will never fall!
    Quote Quote  
  9. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    @ edDV- Yes, I would prefer encoding to x264, but I upload all my videos to my TivoHD. It doesn't play well with 23.976fps h.264 video for some reason (I had a thread earlier about shimmering subtitles). I have submitted a bug report with Tivo, so hopefully it is something they can fix.

    @Abas-Avara- Yeah, I understand that most software players support softsubs. I am not watching these on a PC though. I already own VideoRedo (which I am very happy with for fixing timestamp issues and cutting commercials). I was asking about Womble because edDV initially thought it could IVTC without re-encode.
    Quote Quote  
  10. Member edDV's Avatar
    Join Date
    Mar 2004
    Location
    Northern California, USA
    Search Comp PM
    Originally Posted by txporter View Post
    @ edDV- Yes, I would prefer encoding to x264, but I upload all my videos to my TivoHD. It doesn't play well with 23.976fps h.264 video for some reason (I had a thread earlier about shimmering subtitles). I have submitted a bug report with Tivo, so hopefully it is something they can fix.
    Yep, direct 23.976 feeds are relatively new for players (e.g. Blu-Ray and 24p HDTV combos). Most players want interlace MPeg2 or AVCHD so they can inverse telecine or deinterlace themselves.

    Further, broadcast telecined feeds are likely to have cadence breaks. There is no standard (technical or legal) that requires cadence be maintained.
    Recommends: Kiva.org - Loans that change lives.
    http://www.kiva.org/about
    Quote Quote  
  11. Originally Posted by txporter View Post
    Is there any drawback to resize width in one step and then height in another?
    No, just don't resize the height while it's still interlaced. It's OK to resize the width.
    Quote Quote  
  12. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Originally Posted by manono View Post
    Originally Posted by txporter View Post
    Is there any drawback to resize width in one step and then height in another?
    No, just don't resize the height while it's still interlaced. It's OK to resize the width.
    Thanks, manono. That is quite a bit faster than doing it afterwards. I also noted that you resized the height before Undot. I thought that it was normally better to apply filters before resize. If I were to do something like fft3dfilter or lsfmod or some other more complicated filter than Undot/RemoveGrain(1), is it better to resize after those or fine to resize first?
    Quote Quote  
  13. Yes, as a general rule you would apply filters before resizing, otherwise you might be resizing artifacts. But with undot, its so weak that the difference is probably negligible. Of course it's very situation and source specific, but applying filters to a SD video will be much faster than HD video... so you have to weigh pros/cons

    Since you are re-encoding, another optin is to do your editing in avisynth as well. You could use audiodub() and specify audio in your script to keep sync. You might use avsp or even vdub to do cuts type editing

    Where are your captions from? How are they staying in sync?
    Quote Quote  
  14. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Thanks, pdr. It was mostly a theoretical question anyhow. I tend to do more denoising/sharpening on SD sources. For HD, I basically do as I listed above and just run a higher bitrate.

    As far as editting goes, I am really very happy with VideoRedo for commerical editing, et al. I normally use HCenc, which doesn't work with audio anyhow, so I don't really need to muck with audio in avisynth. My questions before were really raised because edDV thought Womble could IVTC without recoding....which would be pretty cool.

    I missed your question about captions the first time. The captions are just those that come with the video feed. VideoRedo keeps them in sync when editting out commercials.
    Quote Quote  
  15. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Also, I have been meaning to ask. Is it ok to run TFM with MT or setmtmode? It seems like a bad idea, but I don't think I have noted a problem doing so.
    Quote Quote  
  16. I agree with pdr. I was just showing how you could speed up the encoding. Most filters will be faster when applied to the lower final resolution (but be very careful how you filter an interlaced source). And most filters will work most effectively at the original higher resolution. But the quality of an IVTC won't be effected by changing the width to speed it up. As for undot, I didn't even notice it when editing that script, and it probably won't make much difference as far as speed or quality, no matter where you have it in the script.

    I hope you're adjusting the colorimetry somewhere along the line, either with:

    BT709ToBT601()#using the BT709ToBT601 filter

    or the analogous method using the ColorMatrix filter.
    Is it ok to run TFM with MT or setmtmode?
    I do.
    Quote Quote  
  17. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Originally Posted by manono View Post
    I agree with pdr. I was just showing how you could speed up the encoding. Most filters will be faster when applied to the lower final resolution (but be very careful how you filter an interlaced source). And most filters will work most effectively at the original higher resolution. But the quality of an IVTC won't be effected by changing the width to speed it up. As for undot, I didn't even notice it when editing that script, and it probably won't make much difference as far as speed or quality, no matter where you have it in the script.

    I hope you're adjusting the colorimetry somewhere along the line, either with:

    BT709ToBT601()#using the BT709ToBT601 filter

    or the analogous method using the ColorMatrix filter.
    Is it ok to run TFM with MT or setmtmode?
    I do.
    Thanks for mentioning the color change. I saw something about this in the thread about converting HD material to SD and I am confused when I need to use the Colormatrix filter. Do I use Colormatrix 709->601 whenever I am re-encoding HD material? Or only if I am down res'ing it? What about when I go from 1920x1080 to 1280x720 like I am doing here?
    Quote Quote  
  18. Generally, HD is 709, SD is 601 -- unless flagged otherwise.
    Quote Quote  
  19. Originally Posted by txporter View Post
    Do I use Colormatrix 709->601 whenever I am re-encoding HD material? Or only if I am down res'ing it? What about when I go from 1920x1080 to 1280x720 like I am doing here?
    Use it when going from Hi-Def to Standard-Def. 1920x1080 to 1280x720 keeps it Hi-Def, so no need for the filter.

    Oh, that's right, my mistake. You're only going to 720p. Sorry. Ignore me. If for DVD or some Standard-Def resolution, then you need it.
    Quote Quote  
  20. You can encode rec.709 for DVD as long as you flag it correctly.
    Quote Quote  
  21. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Ok, thought I had it until jagabo posted again. So, if I am going from HD to SD, then convert to 601. Unless I am writing to DVD, then I can do either?
    Quote Quote  
  22. So, if I am going from HD to SD, then convert to 601. Unless I am writing to DVD, then I can do either?[/QUOTE]
    Yes. You just have to make sure you tell the MPEG 2 encoder which colorimetry you're video is.

    Click image for larger version

Name:	colorimetry.png
Views:	769
Size:	23.9 KB
ID:	677
    Quote Quote  
  23. Member
    Join Date
    Jan 2009
    Location
    United States
    Search Comp PM
    Ok, thanks for the insight.

    Why exactly do HD video use a different colorimetry than SD?
    Quote Quote  
  24. Originally Posted by jagabo View Post
    Yes. You just have to make sure you tell the MPEG 2 encoder which colorimetry you're video is.
    Have you ever seen a retail DVD with the colorimetry set for BT.701? I don't think I have. They're all usually set for BT.601 equivalents (BT.470-2 or SMPTE 170M) or not defined at all, in which case they're decoded as BT.601. Although they're supposed to probably, I'm not at all sure all DVD players read the flag and follow it. That is, I'm not at all sure all of them can decode a DVD as BT.709 even if that was the colorimetry. I think you'd be well off not explicitely defining anything. The DGIndex Manual has this to say about it:
    Colorimetry - Displays the colorimetry scheme used by the stream. Note that if the stream does not declare the colorimetry, then ITU-R BT.709* is reported for HD video, and ITU-R BT.470-2* is reported for SD video. The * character indicates that the stream did not declare the colorimetry.
    The vast majority of the DVDs I see (a lot) are undeclared, with a few SMPTE 170M and even fewer BT.470-2. Unless you change the colorimetry when going from Hi-Def to DVD, or unless you specifically set it for BT.709 in the encoder, your colors will change. And I suspect that even if you do set it for BT.709, many players won't honor the flag. And encoders such as CCE don't even allow you to set the flag, so it'll be decoded as BT.601, changing the colors if the source was Hi-Def unless you use the ColorMatrix or BT709ToBT601 filters to change it.
    Last edited by manono; 5th Mar 2010 at 18:56.
    Quote Quote  
  25. Originally Posted by manono View Post
    Have you ever seen a retail DVD with the colorimetry set for BT.701?
    Yes, many. Assuming you mean 709.
    Quote Quote  
  26. Oops, yes, BT.709. I don't think I've ever seen one. If you come across one, please post a pic from the Info screen of DGIndex or some other app you trust.
    Quote Quote  
  27. Yes, I know DgIndex had some problems with colorimetry in the past. I've seen a few 709 DVDs recently but I don't remember what they were. I wouldn't be surprised if some DVD players play them as if they were 601.
    Quote Quote  
  28. Anonymous344
    Guest
    Originally Posted by edDV View Post
    Cut commercials on I frames or with Womble. Then inverse telecine the segments, then append. No re-encoding except inside the transition GOP if Womble is used.
    There's only no re-encoding with Womble if you are editing SD content. HD MPEG-2 content is re-encoded.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!