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 12th December 2024, 16:45   #1  |  Link
javieracdc
Registered User
 
Join Date: Apr 2024
Posts: 14
Encoding audio for h264 blu ray encoding with x264

I'm trying to encode a video using x264 for using blu ray compliant according with these commands:

https://web.archive.org/web/20211016...m/home/1080i-p

Which it produces out.264 raw video.

Later I extract the audio source from the original video and I mux them to Blu Ray structure with tsmuxer. However when I play the video, the audio and video got out of sync.

how can i encode the audio which allow me that the audio source match with the timepstamps of h264 video?
javieracdc is offline   Reply With Quote
Old 13th December 2024, 12:58   #2  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 163
You need to tell us the framerate of the video, your command line, and also what happen if you combine the video and audio in a mkv.

I suspect your encode is flawed and the framerate in the .264 container is not a standard value, which tsMuxer is obligated to adjust. Is the framerate reported by tsMuxer the one you expect?
cubicibo is offline   Reply With Quote
Old 13th December 2024, 13:48   #3  |  Link
javieracdc
Registered User
 
Join Date: Apr 2024
Posts: 14
Quote:
Originally Posted by cubicibo View Post
You need to tell us the framerate of the video, your command line, and also what happen if you combine the video and audio in a mkv.
The original video has variable framerates, it does not have a constant framerate, that is why I ask, because extracting the audio from original video (VFR) to a video converted to CFR, out of sync.
I suspect your encode is flawed and the framerate in the .264 container is not a standard value, which tsMuxer is obligated to adjust. Is the framerate reported by tsMuxer the one you expect?
The original video has variable framerates, it does not have a constant framerate, that is why I ask, because extracting the audio from original video (VFR) to a video converted to CFR, out of sync.

I performed some command with ffmpeg to encode the video and audio at the same time allowing the video has blu ray compliant, but i dont know if this command is enough or not:

Quote:
ffmpeg -i input -c:v libx264 -preset veryslow -profile:v high -x264opts bitrate=21700:level=4.2:keyint=60:min-keyint=1:bluray-compat=1:slices=4:ref=4pen-gop=1:ref=4:vbv-maxrate=40000:vbv-bufsize=30000:weightp=0:b-pyramid=strict:cabac=1 -vf "fps=30000/1001,scale=1920:1080" -c:a ac3 -b:a 223k -ar 48000 -y output.mkv
javieracdc is offline   Reply With Quote
Old 13th December 2024, 21:46   #4  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 163
H.264 level 4.2 is not Blu-ray compatible. The highest supported level is 4.1. Also, if you target 29.97 progressive, keyint must be 30, not 60.

I don't know why your audio drift, but you're not off a good start with this command.
cubicibo is offline   Reply With Quote
Old 13th December 2024, 22:30   #5  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,911
-b:a should be 224k, not 223k.
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 14th December 2024, 19:31   #6  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,808
https://forum.doom9.org/showthread.p...06#post2011406
If it is about the same source, then she same answers from there apply.
If you force 30000/1001 on a VFR from 59.465 to 12 000.000 fps source, then you order the result to be out of sync.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Old 15th December 2024, 00:44   #7  |  Link
javieracdc
Registered User
 
Join Date: Apr 2024
Posts: 14
Quote:
Originally Posted by cubicibo View Post
H.264 level 4.2 is not Blu-ray compatible. The highest supported level is 4.1. Also, if you target 29.97 progressive, keyint must be 30, not 60.

I don't know why your audio drift, but you're not off a good start with this command.
Thanks for aclaration

I was testing with framerate 59.940 and profile 4.2 and burned to a blu ray disk and in a Samsung BD-F5100 player it worked without problems. I also tested it with Cyber power DVD and PlayerFab and both played without issues.

I think this should extend the capabilities of the current blu ray standards to improve the video quality a bit more.
javieracdc is offline   Reply With Quote
Old 16th December 2024, 08:48   #8  |  Link
cubicibo
Registered User
 
Join Date: Feb 2022
Posts: 163
Blu-ray Disc players manufacturers are free to support more than what the Blu-ray format requires. This includes HFR, AVC levels beyond 4.1 as well as other codecs and containers. Your disc will certainly not play appropriately in numerous commercial players, especially ancient ones.

In any case, a level 4.2 encode with bluray-compat=1 and slices=4 is nearly equal to a level 4.1 encode. You are simply lucky your player supports HFR, the manual even claims the opposite and specify a maximum framerate of 29.97. The truth is, these BD-only 2013+ players use SoCs with 3D capabilities disabled. However 3DBD SoCs have AVC (MVC) decoders that must support 59.94p, hence a rather widespread support.

Last edited by cubicibo; 16th December 2024 at 08:51.
cubicibo is offline   Reply With Quote
Old 17th December 2024, 21:00   #9  |  Link
javieracdc
Registered User
 
Join Date: Apr 2024
Posts: 14
Quote:
Originally Posted by cubicibo View Post
Blu-ray Disc players manufacturers are free to support more than what the Blu-ray format requires. This includes HFR, AVC levels beyond 4.1 as well as other codecs and containers. Your disc will certainly not play appropriately in numerous commercial players, especially ancient ones.

In any case, a level 4.2 encode with bluray-compat=1 and slices=4 is nearly equal to a level 4.1 encode. You are simply lucky your player supports HFR, the manual even claims the opposite and specify a maximum framerate of 29.97. The truth is, these BD-only 2013+ players use SoCs with 3D capabilities disabled. However 3DBD SoCs have AVC (MVC) decoders that must support 59.94p, hence a rather widespread support.
Thanks for aclaration!
javieracdc 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 21:27.


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