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 9th October 2015, 21:12   #1  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,469
Advanced IDR frame placement

Have very specific IDR frame placement requirement for x264.

I want IDR frames to have min distance of 24 frames (and maximum of 99), but I don't want scene change detection to be off. In case there are scene changes happening inside 24 frames period I want 2nd one to be skipped. Is this possible at all with x264/ffmpeg?
Is the only way to let x264 create 1st pass and than analyse it and overwrite "broken" places with I frames?
Can I copy x264 frame decision from 1st pass and than adjust it (change "bad" IDR frames to I) and start new encode with this as qpfile?
Will this be ok? Is there a faster way?

Last edited by kolak; 9th October 2015 at 23:17.
kolak is offline   Reply With Quote
Old 9th October 2015, 22:27   #2  |  Link
Desbreko
Registered User
 
Desbreko's Avatar
 
Join Date: Feb 2015
Posts: 55
I think --min-keyint 24 --keyint 99 should do that.
__________________
Twitter, AviSynth scripts
Desbreko is offline   Reply With Quote
Old 9th October 2015, 23:15   #3  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,469
I also thought it will work, but nope.
min-keyint won't help, it gets overruled by scene change detection.

Last edited by kolak; 9th October 2015 at 23:18.
kolak is offline   Reply With Quote
Old 10th October 2015, 12:58   #4  |  Link
kabelbrand
Compression mode: Lousy
 
kabelbrand's Avatar
 
Join Date: Mar 2009
Location: Hamburg, Germany
Posts: 73
Quote:
Originally Posted by kolak View Post
min-keyint won't help, it gets overruled by scene change detection.
That's weird. Can you post your complete command line? Maybe some other option overrides min-keyint, e.g. bluray-compat.
kabelbrand is offline   Reply With Quote
Old 10th October 2015, 13:25   #5  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,469
Let me try again, as I'm sure x264 was overruling min-keyint with content with very short scene changes.

.....


Sorry, you are correct- it works fine with min-keyint, but it's not end of my problem.
I also need some forced ones and when I do it with ffmepg than min-keyint is not working around this forced IDR places (which is expected I think).

Maybe I never run a test with min-keyint, but without forced frames

I have also found new option in ffmpeg: forced-idr=1, which forces forced frames to be for IDR (e.g. not just I). I think I need to do more tests.

Last edited by kolak; 10th October 2015 at 15:51.
kolak is offline   Reply With Quote
Old 12th October 2015, 21:51   #6  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,469
After some tests I end up using scenecut=0. It actually doesn't destroy quality as much as I thought.

Different question. Can I change frame type in x264 1st pass stats from e.g. I frame to P frame and than run 2nd pass encode?
Is it safe or no go?
kolak is offline   Reply With Quote
Old 13th October 2015, 00:37   #7  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,356
Quote:
Originally Posted by kolak View Post
After some tests I end up using scenecut=0. It actually doesn't destroy quality as much as I thought.

Different question. Can I change frame type in x264 1st pass stats from e.g. I frame to P frame and than run 2nd pass encode?
Is it safe or no go?
Use qpfile. Just make a file that lists the frame numbers you want to be IDR, followed by "I".
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 13th October 2015, 20:10   #8  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,469
I know about qpfile, but first I need to know what frames decisions x264 comes up with and based on this I may/may not need to change some frames from I to P, to avoid short GOPs. It's for DASH.
x264 won't respect min-kyint with qpfile.

Last edited by kolak; 13th October 2015 at 20:19.
kolak is offline   Reply With Quote
Old 13th October 2015, 21:14   #9  |  Link
kabelbrand
Compression mode: Lousy
 
kabelbrand's Avatar
 
Join Date: Mar 2009
Location: Hamburg, Germany
Posts: 73
FWIW, do yourself a favour and use fixed GOPs for DASH.
kabelbrand is offline   Reply With Quote
Old 14th October 2015, 21:52   #10  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,469
They are fixed, but in few places they can't be as segment break has to happen on frames chosen by the client. I assume their system will be fine with it (they control hardware box which will be the player).
kolak 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 07:44.


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