Avidemux

From MythTV Official Wiki
Jump to: navigation, search

This is PVR350 specific.


Settings

Set the Outp. fmt to <Mpeg A+V>

This tells avidemux to just pass the DVD through without altering it (apart from the cut points obviously). It should take just 1-5 minutes to save a few Gb nuv.


Simple Editing

This section is mainly produced to support the Nuvexport guide, though will give you simple instructions on how to cut out sections and save a file in the same format.

  1. Start Avidemux 2 through a shortcut or by typing "avidemux2" at a command prompt.
  2. Click the "Open" button and chose the required file to open.
  3. Drag the video slider (just underneath the video screen) to the start of the movie. Use the "Previous Frame" and "Next Frame" buttons (just after play / stop) to navigate to the exact starting frame of the show. Make sure that the frame highlighted is the first one you want at the start of your recording.
  4. Hit the "Selection: End" button (the blue one with a B after it) and click Edit > Cut in the menu.
  5. Now browse to the first set of commercials. If you kept a recorded of the times the commercials appeared then check this, or check the original MythTV recording, otherwise they may be a little tricky to find.
  6. Browse to the start of the commercials, highlighting the first frame you want removed. The one before your highlighted frame will be included in the final video. Now hit the "Selection: Start" button (blue with an A before it).
  7. Now browse to the end of the commercials, highlighting is the first framne you want included in your recording and hit the "Selection: End" (B) button.
  8. Repeat this for all commercials, and the end of the show where you only need to hit the A button.
  9. Once you have finished cutting out any parts you want removed, make sure Video and Audio on the left are set to "Copy" and then click File > Save > Save Video.. in the menu. Chose a name for your video (with correct file name extension) and location and hit Save.
  10. If asked to enable Smart Copy, just hit yes. Leave the Q Factor at default (4) and hit OK. The file will then be saved.


  • You may wish to watch various parts where you have cut, just to make sure they fit together properly and there are no sound errors. Sound errors can usually be fixed by putting the cut points slightly earlier or later than you had done.
  • Remember: A button will remove frame highlighted, B button will delete frame before one highlighted when pressed.
  • If you wish to join two video files together, you can do so using the File > Append button. The new file will be appended to the end of the currently open one. You can try and cut parts out / paste them within the whole recording but this is not always succesful (I get a lot of crashes doing this).


Editing

Basically:

  • record using DVD profile on PVRx50
  • move the nuv file to your editing space
  • use avidemux (2.36, not 2.38) to index and cut out commercials (5 mins)
  • optionally use avidemux to save screenshots (press 'j') (1 min - 20 mins depending on fussiness)
  • save as mpeg (A+V) into show.VOB (5 mins)
  • use qdvdauthor to create menu (5 mins)
  • save as VIDEO_TS (10 mins)
  • burn to DVD (15 mins)
  • optionally use gimp to create cover (hours and hours if you get fancy!!)

Removing a section (advert)

  • Scroll through to where you want the cut to start
  • Now hit the A button to mark the selection-start. This can be on any frame type (at least I've never had a problem)
  • Click through to the end of the advert (I click to the right of the slider in the scroll bar to get a rough place - much quicker than using the keyframe advance)
  • Now, click to the next (or previous) keyframe.
  • Now use the B button to mark the selection-end
  • Hit Delete

Trimming a file (removing leading credits)

  • Go to the first frame
  • Now hit the A button to mark the selection-start
  • Scroll to the frame you want as the first frame
  • Now, click to the next (or previous) keyframe
  • Now use the B button to mark the selection-end
  • Hit Delete

Trimming a file (removing trailing credits)

  • Scroll to the frame you want as the last frame
  • Now, click to the next (or previous) keyframe
  • Now, advance 1 frame (press '6') --- This is important on older versions of avidemux.
  • Now hit the A button
  • Advance to the last frame and hit the B button
  • Hit Delete

Notes:

  • I never use the find black frame - too slow.
  • dragging the slider in the scrollbar is actually really good!!

The reason for the frame advance is that the last frame must be a keyframe (or avidemux complains). If you put your 'cursor' on a keyframe, and mark it as the A-point, avidemux deletes from-and-including the A-point.

The reason for all this is to do with the way mpeg holds video. You know how cine film is a series of still images played one after the other. Well mpeg does have still images (a keyframe or I-frame) and then it stores the changes between that still image and the next frame. These frames are called P-frames or B-frames and they don't contain images, just info about the bits of the image that have changed. This is how mpeg does compression.

So imagine you're going through the video and you show a picture. Then you add a bit of red here and take away some green there... and you get the next picture. Do this 12 times or so. Eventually, just in case a glitch crept in, we have another keyframe.

OK, now do it again... show a keyframe and then make some changes, then more changes. Now, imagine we've cut a section so skip ahead in the video to a random B- or P-frame. This frame contains changes - but they're for a completely different image. So if you apply these changes you end up with a pixellated multicolour screen for a few frames (until a new I-frame appears).

Cory Papenfuss noted:
I would just like to add again that this procedure only works 95% of the time for broadcast/cable captures... about 80% of the time for tape transfers. Avidemux cannot deal with chaining A/V sync throughout the file, and this method will have broken sync with one of these unfortunate captures. The author of avidemux acknowleges this limitation, but says a fair bit of internal work would be needed to fix it.


Advanced Editing

Trimming the top+bottom black bars and saving a film as a 16:9 DVD

In the Video section choose 'DVD'. Then press <Configure> and select encoding type Quantizer, and set the value to 4. Since we'll resize the movie to 16:9 this is where you set the aspect ratio that you want the output played at.

You must press <V Process> to actually do the transcoding.


Optimal Xvid Settings

Never having been one to use MythTV's inbuild transcoder, I've spent much time learning how to use alternative methods to transcode my video recordings. One option is Nuvexport though this is not always appropriate for my need (sometimes it breaks, sometimes I have non-myth recordings to transcode). Avidemux provided me with a very accomplished, multi-OS package to do this with. Unfortunately it's many settings were quite confusing to begin with, and I spent a long time learning what everything did and how to set things properly. The end result is the following which, although not giving as good results as Nuvexport, is pretty near. I can't give you sources for these, just take my word for them being the best in most situations. Google if you need more, but keep in mind that I did, and that's what the following is based on.

If transcoding a MythTV recording, you may have to chose the correct audio track first (Audio > Main Track > Whatever has a bitrate set) and you'll almost deffinately want to edit out commercials (see above).

  • I've always used XviD 4 to transcode things. So chose this from the video section and hit configure.
  • Main
    • Chose Two Pass - Average Bitrate and your required bitrate (1000 is good).
    • Chose Interlaced (see interlacing note), Chroma Optimizer and Turbo Mode. Even if transcoding a cartoon, you should probably leave that option alone.
  • Motion Estimation
    • Motion Search Precision: 6 - Ultra High
    • VHQ Mode: 4 - Wide Search
    • Keep Chroma Motion, 4MV and HQ AC boxes ticked.
    • I frame interval: min 1, max 250 for PAL or 300 for NTSC (note how they correspond to the frame rate - 25fps or 30 fps).
    • Number of B-Frames: 3.
    • Keep Qpel and GMC unticked (purely for compatibility, many players are incompatible with these, though if you only ever watch on PC then you may want to tick Qpel).
  • Quantization
    • Quantization type: H.263
    • I, P and B-Frame Quantizers: min 2, max 8.
    • Tick Trellis Quantization.
  • Second Pass
    • I-Frame Boost: 10
    • I-Frames closer than ... frames: 1
    • ...are reduced by (%): 20
    • Leave the rest at default (max improve: 5, max deg: 5, high bitrate: 0, low: 0, overflow control: 5).

Now you need to configure the filters in order to perform resizing, deinterlacing and cropping.

  • Click the filters button, then Add.
  • Click Crop, and enter values until the green border cuts out everything you want. Whatever is underneath the green will be cropped.
  • Click Add and Resize (not MPlayer Resize). Enter your desired width and height, but keep in mind these must both be divisible by 16. 624x352 for widescreen or 640x480 for 4:3 recordings are common and widely supported.
  • Click Add, go to the Interlacing tab and click "Deinterlace", not KernelDeint or any other deinterlacing filter (see interlacing note). Use the default values.
  • Click Add, go to the Denoise tab (see interlacing note), chose Mplayer hqdn3d and the default values.
  • It is important that the above are performed in the listed order.

Now OK out of the filters window, and alter any audio settings if you need to.

  • Lame is probably the best, it creates MP3s.
  • Configure to Stereo, 128 kbps, CBR.

Now File > Save > Save Video... name it and hit OK. Wait a couple hours, and you'll have a transcoded recording just the way you want it.

Note: Use Of Deinterlacing

Note that you only need to use the interlacing options if the file you are transcoding is interlaced. All raw mythtv files in mpg format that have been recorded from an over-the-air source should be interlaced, but if you are using Avidemux to transcode other files such as thoughs already designed for pc viewing (eg. wmv files, files from the internet) are likely already to be deinterlaced and so you do not need to use the interlacing options when transcoding.

Also note that the same pretty much applies to the denoise option; only raw over-the-air recordings are likely to need it.