Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th June 2017, 08:18   #381  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,319
Quote:
Originally Posted by FranceBB View Post
Thank you for this guide.
I gotta make a Bluray out of a PAL XDCAM MXF file and I'm gonna use Avisynth and x264 this time (not to bother AVID).

I need the maximum compatibility and I think these settings should be fine:

Code:
avs4x264mod.exe "AVS Script.avs" --x264-binary "x264.exe" --bitrate 25000  --preset medium --ref 4 --level 4.1 --profile High --vbv-bufsize 25000 --vbv-maxrate 25000 --overscan show --keyint 25 --slices 4 --sar 1:1  --videoformat PAL --tff --nal-hrd vbr --bluray-compat --colormatrix bt709 --transfer bt709 --colorprim bt709 --range tv --log-level info --thread-input --opencl --output raw_video.h264

Can you confirm they are fine? Any suggestions?
What is your script?
For blu-ray compliant x264 settings you find references here:
http://forum.doom9.org/showpost.php?...19&postcount=1
https://sites.google.com/site/x264bluray/

Last edited by Sharc; 6th June 2017 at 08:23.
Sharc is offline   Reply With Quote
Old 6th June 2017, 09:06   #382  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 1,566
You miss the following to be sure :
Code:
--b-pyramid strict --min-keyint 1 --mvrange 511 --bframe 3 --aud
I'm not sure if --b-pyramid strict is included with the --bluray-compat, so, it will not hurt to add it.
As you're using --tff it means that your video is not progressive, in that case, you also need :
Code:
--pic-struct
You don't need this last one for progressive video.
If you want optimal result, you can add :
Code:
--open-gop
And, you can also go up to these values if you want :
Code:
--vbv-maxrate 40000 --vbv-bufsize 30000
jpsdr is offline   Reply With Quote
Old 6th June 2017, 10:56   #383  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,970
Quote:
Originally Posted by jpsdr View Post
I'm not sure if --b-pyramid strict is included with the --bluray-compat
It is, as are --min-keyint 1, --bframes 3 and --aud. (pyramid and bframes as min(x,y)). Special --mvrange isn't necessary either.

Quote:
Originally Posted by jpsdr View Post
As you're using --tff it means that your video is not progressive, in that case, you also need
--pic-struct is implied by --tff/--bff/--fake-interlaced.

/edit: Oh, he does want to make a Blu-ray out of XDCAM MXF. I didn't read correctly. Personally, I'd just use the examples linked by Sharc. Maybe even use a good deinterlacer like QTGMC to go 720p50.

--sar 1:1 and bt709 are not allowed for PAL. See start post.

Last edited by sneaker_ger; 6th June 2017 at 11:07.
sneaker_ger is offline   Reply With Quote
Old 6th June 2017, 18:16   #384  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,431
Quote:
Originally Posted by sneaker_ger View Post
It is, as are --min-keyint 1
Is my dim recollection of --min-keyint 2 being requires/preferable incorrect?

Also, since he's only using 25 Mbps vbv-bufsize/maxrate, he might as well use Level 4.0 and eliminate --slices 4.

Slices are only required with Level 4.1.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 6th June 2017, 18:23   #385  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,970
Quote:
Originally Posted by benwaggoner View Post
Is my dim recollection of --min-keyint 2 being requires/preferable incorrect?
It would have always been required by the specs but the x264 developers only noticed it in 2012.
http://git.videolan.org/?p=x264/x264...45ff1c1486ad9a
sneaker_ger is offline   Reply With Quote
Old 6th June 2017, 19:34   #386  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 1,566
Quote:
Originally Posted by sneaker_ger View Post
--sar 1:1 and bt709 are not allowed for PAL. See start post.
I thought the video was 1080p.
If video is indeed 576i, that's a total another story.
A lot of optimization can be done indeed.
Reduce the level to 4.0 to avoid slices, and reduce buffer/bitrate max to 15000 to have 2s GOP length.
Buffer and bitrate max at 15000 is very largely enough to properly encode a 576i video. This will allow a max keyint of 50, which will produce even better results.
i would suggest for 576i :
Code:
--profile high --level 4.0 --vbv-maxrate 15000 --vbv-bufsize 15000 --keyint 50 --ref 6 --open-gop
No need for slices. And as video is only 576i, you can increase ref frames to 6.
The sar is according the video, is it a 4/3 or 16/9 video ?
4/3, you have to use :
Code:
--sar 12:11
16/9, you have to use :
Code:
--sar 16:11
The color for pal 576i is :
Code:
--colorprim bt470bg --transfer bt470bg --colormatrix bt470bg --videoformat pal

Last edited by jpsdr; 6th June 2017 at 19:46.
jpsdr is offline   Reply With Quote
Old 8th June 2017, 00:14   #387  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 265
It's 1080i, it's not 720p.
My source it's an XDCAM 1080i 50Mbit/s 4:2:2 yv16, interlaced 25fps (50i), 4 audio tracks: CH.1-2 PCM Stereo German Full Mix, CH.3-4 PCM Stereo Music & Effects. It's really interlaced, it's not just flagged as interlaced and I would like to keep it that way.

Source:

Code:
General

Complete name :	Filemaster.mxf
Format :	MXF
Commercial name :	XDCAM HD422
Format version :	1.2
Format profile :	OP-1a
Format settings :	Closed / Complete
File size :	12.0 GiB
Duration :	28mn 56s
Overall bit rate :	59.2 Mbps
Encoded date :	2017-06-03 20:21:00.208
Writing application :	Omneon Inc. Omneon Media Subsystem 6.4.1.0.1
Writing library :	Omneon Media Api (linux)

Video

ID :	2
Format :	MPEG Video
Commercial name :	XDCAM HD422
Format version :	Version 2
Format profile :	4:2:2@High
Format settings, BVOP :	Yes
Format settings, Matrix :	Custom
Format settings, GOP :	M=3, N=12
Format settings, picture structure :	Frame
Format settings, wrapping mode :	Frame
Codec ID :	0D01030102046101-0401020201040300
Duration :	28mn 56s
Bit rate :	50.0 Mbps
Width :	1 920 pixels
Height :	1 080 pixels
Display aspect ratio :	16:9
Frame rate :	25 fps
Standard :	Component
Color space :	YUV
Chroma subsampling :	4:2:2
Bit depth :	8 bits
Scan type :	Interlaced
Scan order :	Top Field First
Compression mode :	Lossy
Bits/(Pixel*Frame) :	0.965
Time code of first frame :	00:00:00:00
Time code source :	Group of pictures header
Stream size :	10.1 GiB (84%)
Color primaries :	BT.709
Transfer characteristics :	BT.709

Audio #1

ID :	3
Format :	PCM
Format settings, Endianness :	Little
Format settings, wrapping mode :	Frame (BWF)
Codec ID :	0D01030102060100
Duration :	28mn 56s
Bit rate mode :	Constant
Bit rate :	2 304 Kbps
Channel(s) :	2 channels
Sampling rate :	48.0 KHz
Frame rate :	25 fps
Bit depth :	24 bits
Stream size :	477 MiB (4%)

Audio #2

ID :	4
Format :	PCM
Format settings, Endianness :	Little
Format settings, wrapping mode :	Frame (BWF)
Codec ID :	0D01030102060100
Duration :	28mn 56s
Bit rate mode :	Constant
Bit rate :	2 304 Kbps
Channel(s) :	2 channels
Sampling rate :	48.0 KHz
Frame rate :	25 fps
Bit depth :	24 bits
Stream size :	477 MiB (4%)

Audio #3

ID :	5
Format :	PCM
Format settings, Endianness :	Little
Format settings, wrapping mode :	Frame (BWF)
Codec ID :	0D01030102060100
Duration :	28mn 56s
Bit rate mode :	Constant
Bit rate :	2 304 Kbps
Channel(s) :	2 channels
Sampling rate :	48.0 KHz
Frame rate :	25 fps
Bit depth :	24 bits
Stream size :	477 MiB (4%)

Audio #4

ID :	6
Format :	PCM
Format settings, Endianness :	Little
Format settings, wrapping mode :	Frame (BWF)
Codec ID :	0D01030102060100
Duration :	28mn 56s
Bit rate mode :	Constant
Bit rate :	2 304 Kbps
Channel(s) :	2 channels
Sampling rate :	48.0 KHz
Frame rate :	25 fps
Bit depth :	24 bits
Stream size :	477 MiB (4%)

Other #1

ID :	1-Material
Type :	Time code
Format :	MXF TC
Time code of first frame :	10:00:00:00
Time code settings :	Material Package
Time code, striped :	Yes

Other #2

ID :	1-Source
Type :	Time code
Format :	MXF TC
Time code of first frame :	10:00:00:00
Time code settings :	Source Package
Time code, striped :	Yes
My Avisynth Script:

Code:
video=FFVideoSource("Filemaster.mxf")
ch1=WAVSource("ch1.wav")
ch2=WAVSource("ch2.wav")
audio=MergeChannels(ch1, ch2)
AudioDub(video, audio)
Normalize(0.89, show=false)
Converttoyv12(interlaced=true)
f3kdb(range=15, Y=80, Cb=60, Cr=60, grainY=0, grainC=0, keep_tv_range=True, input_depth=8, output_depth=8)
My "new" x264.bat (I added jpsdr suggestions):

Code:
avs4x264mod.exe "AVS Script.avs" --x264-binary "x264.exe" --bitrate 25000  --preset medium --ref 4 --level 4.1 --profile High --vbv-bufsize 40000 --vbv-maxrate 30000 --overscan show --keyint 25 --slices 4 -b-pyramid strict --min-keyint 1 --mvrange 511 --bframe 3 --aud --sar 1:1  --pic-struct --videoformat PAL --interlaced --tff --nal-hrd vbr --bluray-compat --colormatrix bt709 --transfer bt709 --colorprim bt709 --range tv --log-level info --thread-input --opencl --output raw_video.h264
Quote:
If you want optimal result, you can add :
--open-gop
Uhm... I noticed that XDCAM files require closed GOP: M=3, N=12. I'm gonna encode a Bluray, which is different and in H.264, so it's different, but is --open-gop going to be a problem? Will I benefit from it without affecting compatibility?

Quote:
Maybe even use a good deinterlacer like QTGMC
I know QTGMC, it's my first favorite deinterlacer (the second one is tdeint). Anyway, my source is 1080i, is it really worth deinterlacing? I don't think 1920x1080 25fps progressive is allowed by Bluray, is it?

Quote:
--sar 1:1 and bt709 are not allowed for PAL. See start post.
Ok. --sar 1:1 it's the one for 1920x1080, right? And BT.709 it's the colormatrix for HD contents, like my source. Also, it seems that it's also suggested as option here: https://sites.google.com/site/x264bluray/home/1080i
Are you sure it's not supported?

Last edited by FranceBB; 8th June 2017 at 00:20.
FranceBB is offline   Reply With Quote
Old 8th June 2017, 08:41   #388  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 1,566
Source and target are different. If you target Blu-Ray, you can use open-gop (needs bluray-compat but you've put it, so it's fine), it doesn't matter what source has, this parameter is for the target only.
And as it's HD 1920x1080, the sar is 1:1 and color is BT.709. For me, your command line is good.
About deinterlace and the remark about the sar and color, it's probably because he thought it was 576i.
jpsdr is offline   Reply With Quote
Old 8th June 2017, 09:35   #389  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,970
Quote:
Originally Posted by jpsdr View Post
About deinterlace and the remark about the sar and color, it's probably because he thought it was 576i.
Yes, he only mentioned "PAL XDCAM MXF" which I assumed to be 720x576 interlaced. He didn't say anything about 1080i.


I would remove "--videoformat PAL" and "--overscan show", I'm not sure they are allowed or appropriate. (And maybe --opencl if you're targeting production. The minor speedup might not be worth the additional stability risks.)
sneaker_ger is offline   Reply With Quote
Old 8th June 2017, 11:51   #390  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,319
"If something CAN be made complicated, it WILL..." (Murphy).
Why not follow the instructions for blu-ray compliant encoding given in the first post of this thread, and the links to the examples with commandlines provided at the end of the first post of this sticky ...
Sharc is offline   Reply With Quote
Old 8th June 2017, 15:39   #391  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 265
Quote:
Originally Posted by jpsdr View Post
Source and target are different. If you target Blu-Ray, you can use open-gop (needs bluray-compat but you've put it, so it's fine), it doesn't matter what source has, this parameter is for the target only.
And as it's HD 1920x1080, the sar is 1:1 and color is BT.709. For me, your command line is good.
About deinterlace and the remark about the sar and color, it's probably because he thought it was 576i.
Got it.

Quote:
Originally Posted by sneaker_ger View Post
Yes, he only mentioned "PAL XDCAM MXF" which I assumed to be 720x576 interlaced. He didn't say anything about 1080i.


I would remove "--videoformat PAL" and "--overscan show", I'm not sure they are allowed or appropriate. (And maybe --opencl if you're targeting production. The minor speedup might not be worth the additional stability risks.)
Yes, I'm gonna remove them.

Thank you, everyone!
FranceBB is offline   Reply With Quote
Old 8th June 2017, 19:47   #392  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 997
Everything can be summarized as:
Quote:
avs4x264mod.exe "AVS Script.avs" --x264-binary "x264.exe" --bitrate 25000 --preset medium --ref 4 --level 4.1 --profile High --vbv-bufsize 30000 --vbv-maxrate 40000 --keyint 25 --slices 4 --bframe 3 --sar 1:1 --tff --bluray-compat --colormatrix bt709 --transfer bt709 --colorprim bt709 --log-level info --thread-input --output raw_video.h264
and you'll get the same quality.

NOTE: In your command line you've switched the values of bufsize and maxrate. Bufsize needs to be 30 Mbps max, while maxrate can be up to 40 Mbps.
With your values, you'll get out of specs discs. Depending by the authoring software, you can get your file rejected or accepted but with buffer overflows problems during multiplexing or verification process.

Also, can't understand why you're normalizing your audio by peak (that can create weird results). I guess you know there are EBU standards and normalizing by peak will likely alter the audio in a not-standard way. Do you have valid reasons for that?
mp3dom is offline   Reply With Quote
Old 8th June 2017, 19:50   #393  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,431
And yes, if your source is interlaced, you probably should just leave it like that. Anything else will lose spatial or temporal detail.


Sent from my iPhone using Tapatalk
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 8th June 2017, 20:01   #394  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 4,970
Quote:
Originally Posted by mp3dom View Post
Everything can be summarized as:
--profile High --bframe 3 --log-level info --thread-input could also be dropped, while we're at it (and default is --ref 3). But of course it doesn't make any difference.


As Sharc said people make things too complicated instead of just reading the docs/examples...

Last edited by sneaker_ger; 8th June 2017 at 20:16.
sneaker_ger is offline   Reply With Quote
Old 9th June 2017, 02:03   #395  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 265
Quote:
Originally Posted by mp3dom View Post
Everything can be summarized as:

and you'll get the same quality.

NOTE: In your command line you've switched the values of bufsize and maxrate. Bufsize needs to be 30 Mbps max, while maxrate can be up to 40 Mbps.
With your values, you'll get out of specs discs. Depending by the authoring software, you can get your file rejected or accepted but with buffer overflows problems during multiplexing or verification process.

Also, can't understand why you're normalizing your audio by peak (that can create weird results). I guess you know there are EBU standards and normalizing by peak will likely alter the audio in a not-standard way. Do you have valid reasons for that?
Got it. I'm gonna bring them back to 25Mbit/s just to be 100% sure.
Besides, I need my audio to be as close as possible to -24 LUFS. We generally use a machine called "Sony DP 600" to achieve this. Is there a similar way to achieve this via avisynth?

Last edited by FranceBB; 9th June 2017 at 02:09.
FranceBB is offline   Reply With Quote
Old 9th June 2017, 08:40   #396  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 997
Quote:
Originally Posted by FranceBB View Post
Besides, I need my audio to be as close as possible to -24 LUFS. We generally use a machine called "Sony DP 600" to achieve this. Is there a similar way to achieve this via avisynth?
As far as I know, no, there isn't. You need a DAW and proper plugins to do that. -24db(-23, depending on the program) LUFS is the standard and is not so loud. If you normalize by peak you can get totally wrong results. Think of an inaudible audio with just a single peak at -3 dB, you'll get your audio boosted by only 2dB. The LUFS in that case will be even lower than -24 (probably -30) so it will be rejected. The other case, a very compressed (by dynamic range) audio where you have plenty of spikes at -5dB, you'll get a boost of 4dB so a very louder audio will be even louder. The LUFS in that case will probably be -18 or even higher. Normalizing by peak is, almost always, a bad choice.

If you can't access to a DAW/plugins, you can get decent results normalizing by RMS, with a target value of -26/-27dB. Still, this may be fine for non-professional jobs, because if you deliver the audio for broadcasting, you need to strictly follow the EBU standard.

Last edited by mp3dom; 9th June 2017 at 17:12.
mp3dom is offline   Reply With Quote
Old 1st January 2018, 04:04   #397  |  Link
imsrk48
Registered User
 
Join Date: Nov 2017
Posts: 11
where is color correction option in MeGui Latest Version

Sent from my P4 using Tapatalk
imsrk48 is offline   Reply With Quote
Old 11th March 2018, 17:13   #398  |  Link
DenisRodman
Registered User
 
Join Date: Jul 2015
Posts: 26
Timebased Slideshow

Quote:
The HDMV Timebased Slideshow is an application to present still pictures. It is same as movie presentation except that a presenting picture is a still picture. A still picture is coded as an MPEG-4 AVC IDR I-frame or an HEVC IDR I-frame. Presentation timing of the still picture is controlled by the associated PTS value and the presentation progresses with predefined timing axis. The stream of the Timebased Slideshow may contain data of Audio, Subtitle and Graphics. The presentation timing of these data is controlled by each PTS value in the stream.
I have 10 pictures 1.png, 2.png, 3.png ... 10.png how can create Timebased Slideshow MPEG-4 AVC IDR I-frame?

Please write the full code Command Line.

Thanks.
DenisRodman is offline   Reply With Quote
Old 15th May 2018, 10:32   #399  |  Link
Qarmaa
Registered User
 
Join Date: Sep 2017
Posts: 4
Quote:
Originally Posted by DenisRodman View Post
I have 10 pictures 1.png, 2.png, 3.png ... 10.png how can create Timebased Slideshow MPEG-4 AVC IDR I-frame?

Please write the full code Command Line.

Thanks.
There is no way you can do this by using only x264. To create compliant timebased or browsable slideshow you need to integrate AVC SEI metadata:

Code:
ct_type: 2
nuit_field_base_flag: 1
counting_type: 4
full_timestamp_flag: 0
discontinuity_flag: 0
cnt_dropped_flag: 0
n_frame: 0
seconds_flag: 1
seconds_value: 1
(From stream produced by Scenarist's Still Image Encoder)


Those parameters can be set via libav's API

Last edited by Qarmaa; 15th May 2018 at 10:44.
Qarmaa is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.