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 Encoder GUIs

Reply
 
Thread Tools Search this Thread Display Modes
Old Yesterday, 18:19   #2061  |  Link
jlw_4049
Registered User
 
Join Date: Sep 2018
Posts: 241
Quote:
Originally Posted by lordalibaski View Post
Why do I have this out of sync problem all the time when trying a new beta and this is a fresh install.

Small clip of the original file
https://fromsmash.com/QKXLk4kKHN-bt

Converted file out of sync (this is the full file conversion)
https://fromsmash.com/UumR.w.GNn-bt

No matter what format I try to convert it to it goes out of sync.

ok it will keep that small file in sync but won't keep the full file in sync!!

Here is the full file if anyone wants to see if they have the same problem I'm using the latest beta.

https://fromsmash.com/7clueZsqO.-bt
Send me the file if you can and the process. Ill see what I can figure out.

Sent from my SM-G986U1 using Tapatalk
jlw_4049 is offline   Reply With Quote
Old Yesterday, 18:36   #2062  |  Link
lordalibaski
Registered User
 
Join Date: May 2016
Posts: 58
Hi jlw

I've uploaded it mate it's in the above post bottom link that's the original file.
lordalibaski is offline   Reply With Quote
Old Yesterday, 19:06   #2063  |  Link
jlw_4049
Registered User
 
Join Date: Sep 2018
Posts: 241
Quote:
Originally Posted by lordalibaski View Post
Hi jlw

I've uploaded it mate it's in the above post bottom link that's the original file.
You need to extract the .mpg file from the VOB, encode that, then after words you can put it all back together in a .mkv or .mp4 or what ever else.

EDIT: I've encoded/muxed several different ways. EVERY way left the audio out of sync. For what ever reason, I'm assuming there is an issue with your source.

Last edited by jlw_4049; Yesterday at 19:38.
jlw_4049 is offline   Reply With Quote
Old Yesterday, 22:28   #2064  |  Link
lordalibaski
Registered User
 
Join Date: May 2016
Posts: 58
That's my conclusion as well jlw

No matter what you do with the full show it sends it out of sync, though if you trim a 5min segment and convert it's perfectly fine it's only when you try to convert the whole show then it goes out of sync.
lordalibaski is offline   Reply With Quote
Old Yesterday, 22:59   #2065  |  Link
lordalibaski
Registered User
 
Join Date: May 2016
Posts: 58
Right I've just tried the exact same source in handbrake and the conversion was completely in sync so this is not a source fault.
lordalibaski is offline   Reply With Quote
Old Today, 00:49   #2066  |  Link
JKyle
Registered User
 
Join Date: Sep 2018
Posts: 165
Quote:
Originally Posted by lordalibaski View Post
Right I've just tried the exact same source in handbrake and the conversion was completely in sync so this is not a source fault.
Well, it is a source fault. More specifically, the frame rate of the video stream is irregular: there are dropped frames in the video stream.

MediaInfo (and MediaInfo.NET) shows (incorrectly) that it has 23.976 (24000/1001) fps, but if you look into the file using ffprobe, you get the following info:

Quote:
Input #0, mpeg, from 'Test.vob':
Duration: 00:19:20.00, start: 0.280633, bitrate: 4296 kb/s
Stream #0:0[0x1bf]: Data: dvd_nav_packet
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 8:9 DAR 4:3], Closed Captions, 6000 kb/s, 29.58 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Side data:
cpb: bitrate max/min/avg: 6000000/0/0 buffer size: 1835008 vbv_delay: N/A
Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Therefore, if you encode this file using FFmpeg (or other FFmpeg based apps like Handbrake, etc.), the video encoder automatically fills in the dropped frames by duplicating frames appropriately.

In reality, if you run the following simple FFmpeg command in CMD, you'll verify it in the real time log message of FFmpeg.

Code:
ffmpeg -hide_banner -i Test.vob -c:v libx264 -crf 22.0 -preset medium -c:a aac -ac 2 -b:a 128k -sn -map_metadata -1 -map_chapters -1 -y Test.mp4
[Log]

Quote:
......
More than 1000 frames duplicated 20992kB time=00:02:45.60 bitrate=1038.4kbits/s dup=992 drop=0 speed=5.18x
frame=34796 fps=134 q=-1.0 Lsize= 156058kB time=00:19:20.92 bitrate=1101.2kbits/s dup=6953 drop=0 speed=4.47x
video:146096kB audio:9063kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.579034%
......
In StaxRip (and other AVS based apps), the video stream frame rate info differs depending on what kind of source filter you use for this file (29.97 for DGSource, 24 for FFVideoSource, etc.), and that's what makes the problem complicated in this case.


Then, how can we make StaxRip fill in dropped frames by duplicating frames?

Well, in theory, putting ChangeFPS(30000, 1001) in the AVS script is expected to solve this out-of-sync problem, but in reality, it doesn't. Since StaxRip splits video and audio and deals with them separately, video/audio sync is not tackled appropriately by this method.

In my experience, piping via FFmpeg along with a forced frame rate seems to be more effective for out-of-sync problems.

Suppose you want to encode an HEVC video stream via NVEnc, but you want to fix this dropped frame issue as well.
In this case, instead of piping via avs2pipemod, select Command Line encoder and edit the code like this:

Quote:
"%app:ffmpeg%" -hwaccel dxva2 -i "%source_file%" -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p -loglevel fatal -hide_banner -r 30000/1001 - | "%app:NVEnc%" --vbrhq 0 --codec h265 --preset quality --vbr-quality 30 --aq --ref 4 --lookahead 32 --y4m -i - -o "%temp_dir%%target_name%_out.h265"
You can force the frame rate by using this -r option in ffmpeg.

(This is why you need to create a Command Line encoder profile instead of choosing ffmpeg (DXVA2) decoder in NVEnc options.
Technically, choosing ffmpeg (DXVA2) decoder in NVEnc options is exactly the same as the above Command Line encoder code except for the -r option.
I think it'd be good if @stax76 implemented this additional item in NVEnc ffmpeg (DXVA2) decoder option. )

Choose your own audio encoding.

After muxing is done, you will see the final sync is a little bit off: video is a little delayed behind audio. But as ffprobe tells us, the video starts at 0.280633 second, i.e., about 281 milliseconds.

So, you need to remux video (hevc) and audio by delaying the audio by 281 milliseconds.



Now you'll see the output is fully in sync.

Last edited by JKyle; Today at 03:57.
JKyle is offline   Reply With Quote
Old Today, 03:43   #2067  |  Link
Disturbance
Registered User
 
Join Date: Mar 2007
Posts: 25
Quote:
Originally Posted by sneaker_ger View Post
@Disturbance:
Unlike for mp4, Matroska timestamps aren't exact for 24/1.001 fps. So with a very short file like yours MediaInfo might display such unexpected fps. It is not a bug in mkvmerge. My guess is for files longer than a few seconds MediaInfo will show fps as you expect.
I spent about 3 days working on this to try getting it to work and this ended up being the solution, that my clips needed to be longer and then they would display the correct fps, thank you to everyone else as well that commented and helped me. It is good to have the issue fixed, it just doesn't feel good it took me so long to realise it was as usual, user error.
Disturbance is offline   Reply With Quote
Old Today, 07:19   #2068  |  Link
jlw_4049
Registered User
 
Join Date: Sep 2018
Posts: 241
Quote:
Originally Posted by JKyle View Post
Well, it is a source fault. More specifically, the frame rate of the video stream is irregular: there are dropped frames in the video stream.

MediaInfo (and MediaInfo.NET) shows (incorrectly) that it has 23.976 (24000/1001) fps, but if you look into the file using ffprobe, you get the following info:



Therefore, if you encode this file using FFmpeg (or other FFmpeg based apps like Handbrake, etc.), the video encoder automatically fills in the dropped frames by duplicating frames appropriately.

In reality, if you run the following simple FFmpeg command in CMD, you'll verify it in the real time log message of FFmpeg.

Code:
ffmpeg -hide_banner -i Test.vob -c:v libx264 -crf 22.0 -preset medium -c:a aac -ac 2 -b:a 128k -sn -map_metadata -1 -map_chapters -1 -y Test.mp4
[Log]



In StaxRip (and other AVS based apps), the video stream frame rate info differs depending on what kind of source filter you use for this file (29.97 for DGSource, 24 for FFVideoSource, etc.), and that's what makes the problem complicated in this case.


Then, how can we make StaxRip fill in dropped frames by duplicating frames?

Well, in theory, putting ChangeFPS(30000, 1001) in the AVS script is expected to solve this out-of-sync problem, but in reality, it doesn't. Since StaxRip splits video and audio and deals with them separately, video/audio sync is not tackled appropriately by this method.

In my experience, piping via FFmpeg along with a forced frame rate seems to be more effective for out-of-sync problems.

Suppose you want to encode an HEVC video stream via NVEnc, but you want to fix this dropped frame issue as well.
In this case, instead of piping via avs2pipemod, select Command Line encoder and edit the code like this:



You can force the frame rate by using this -r option in ffmpeg.

(This is why you need to create a Command Line encoder profile instead of choosing ffmpeg (DXVA2) decoder in NVEnc options.
Technically, choosing ffmpeg (DXVA2) decoder in NVEnc options is exactly the same as the above Command Line encoder code except for the -r option.
I think it'd be good if @stax76 implemented this additional item in NVEnc ffmpeg (DXVA2) decoder option. )

Choose your own audio encoding.

After muxing is done, you will see the final sync is a little bit off: video is a little delayed behind audio. But as ffprobe tells us, the video starts at 0.280633 second, i.e., about 281 milliseconds.

So, you need to remux video (hevc) and audio by delaying the audio by 281 milliseconds.



Now you'll see the output is fully in sync.
This is good advice

Sent from my SM-G986U1 using Tapatalk
jlw_4049 is offline   Reply With Quote
Reply

Tags
aac, hdr, hevc, nvenc, staxrip, x264, x265

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 08:17.


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