lisamelton / video_transcoding

Tools to transcode, inspect and convert videos.
MIT License
2.39k stars 160 forks source link

Settings recommendations for HDHomeRun MPEG2 videos? #311

Open kvanh opened 4 years ago

kvanh commented 4 years ago

I use Plex DVR with an HDHomeRun and the files are stored as MPEG2 videos. These files are huge so I want to transcode to m4v. Default and --quick (both with --m4v) seemed to produce good results on a 3 hour 1080p original. Quick was obviously way faster. File size went from 18GB to 5GB.

Just wondering there are settings that might get that file smaller or encode it faster.

lisamelton commented 4 years ago

@kvanh With the x264 software encoder, you really don't want to go faster than using the --quick option. You can always try adding --target small to reduce the size.

Or, to go really fast, you could try my new tool, other-transcode, available here:

https://github.com/donmelton/other_video_transcoding

It automatically selects a platform-specific hardware video encoder rather than relying on a slower software encoder. Using an encoder built into a CPU or video card means that even Blu-ray Disc-sized media can be transcoded 5 to 10 times faster than its original playback speed, depending on which hardware is available.

samhutchins commented 4 years ago

@donmelton @kvanh It's probably worth noting that the output from other-transcode will be bigger by default than transcode-video. You'd need to use the --target 1080p=<bitrate> option to bring it back down

lisamelton commented 4 years ago

@samhutchins @kvanh Good point! Yes, and the --target option essentially works the same way in other-transcode as it does in transcode-video.

arejay73 commented 4 years ago

I noticed that for recordings from HDHomerun that are in 5.1 audio the resulting compressed file has changed the order and 5.1 audio is not the first track, but the second. here is output from mediainfo exec before and after. I used command with both --main-audio 1 and without and got the same results. I would like to force the 5.1 audio to be the default and stereo to be backup.

transcode-video --m4v --encoder vt_h264 --main-audio 1 "FBI S01E11 2019-01-15 Identity Crisis 2019-01-15-2100.mpg"

Original mpg file:

General
ID                                       : 751 (0x2EF)
Complete name                            : FBI S01E11 2019-01-15 Identity Crisis 2019-01-15-2100.mpg
Format                                   : MPEG-TS
File size                                : 6.10 GiB
Duration                                 : 59 min 58 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 14.6 Mb/s
Movie name                               : NCIS
Law rating                               : TV-14 (LV)
FileExtension_Invalid                    : ts m2t m2s m4t m4s tmf ts tp trp ty

Video
ID                                       : 49 (0x31)
Menu ID                                  : 3 (0x3)
Format                                   : MPEG Video
Format version                           : Version 2
Format profile                           : Main@High
Format settings                          : CustomMatrix / BVOP
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Custom
Format settings, GOP                     : Variable
Format settings, picture structure       : Frame
Codec ID                                 : 2
Duration                                 : 59 min 58 s
Bit rate mode                            : Variable
Bit rate                                 : 13.2 Mb/s
Maximum bit rate                         : 15.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.212
Stream size                              : 5.52 GiB (91%)
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio #1
ID                                       : 52 (0x34)
Menu ID                                  : 3 (0x3)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : 129
Duration                                 : 59 min 58 s
Bit rate mode                            : Constant
Bit rate                                 : 448 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : -332 ms
Stream size                              : 192 MiB (3%)
Language                                 : English
Service kind                             : Complete Main

Audio #2
ID                                       : 53 (0x35)
Menu ID                                  : 3 (0x3)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : 129
Duration                                 : 59 min 58 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : -358 ms
Stream size                              : 82.4 MiB (1%)
Language                                 : Spanish
Service kind                             : Complete Main

Compressed File:

General
Complete name                            : FBI S01E11 2019-01-15 Identity Crisis 2019-01-15-2100.m4v
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/iso2/avc1/mp41)
File size                                : 2.78 GiB
Duration                                 : 59 min 58 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 6 625 kb/s
Encoded date                             : UTC 2020-01-24 17:27:50
Tagged date                              : UTC 2020-01-24 17:27:50
Writing application                      : HandBrake 1.3.1 2020010700

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 59 min 58 s
Bit rate mode                            : Variable
Bit rate                                 : 6 003 kb/s
Maximum bit rate                         : 768 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 29.970 (29970/1000) FPS
Minimum frame rate                       : 1.824 FPS
Maximum frame rate                       : 29.970 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.097
Stream size                              : 2.51 GiB (91%)
Encoded date                             : UTC 2020-01-24 17:27:50
Tagged date                              : UTC 2020-01-24 17:27:50
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio #1
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 59 min 58 s
Bit rate mode                            : Constant
Bit rate                                 : 165 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 70.6 MiB (2%)
Title                                    : Stereo
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2020-01-24 17:27:50
Tagged date                              : UTC 2020-01-24 17:27:50
Fallback From                            : 3

Audio #2
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : ac-3
Duration                                 : 59 min 58 s
Bit rate mode                            : Constant
Bit rate                                 : 448 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 192 MiB (7%)
Title                                    : Surround
Language                                 : English
Service kind                             : Complete Main
Default                                  : Inherited From: 2
Alternate group                          : 1
Encoded date                             : UTC 2020-01-24 17:27:50
Tagged date                              : UTC 2020-01-24 17:27:50
Fallback To                              : 2
lisamelton commented 4 years ago

@arejay73 Placing the AAC version before the AC-3 version of your main audio is a feature necessary for playback on many Apple devices.

You can reverse the order of double width audio tracks using the --reverse-double-order option.

However, since you're using Plex, you're better off just setting the width of your main audio to only output a single track and not have a "backup" in stereo since, trust me, you'll probably never use it. You can do that by adding --audio-width main=surround on your command line.