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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd March 2009, 07:49   #1  |  Link
jonatan
Registered User
 
Join Date: Mar 2009
Posts: 5
slices in x264 for IP streaming

Hi, I would like to use x264 fo streaming over IP and I will have a packet size limit of 1400 bytes. Due to resolution, framerate and bitrate restrictions, each frame will consist of around 10 packets. However, the connection is not perfect so there can be packet-losses.

The thing is, if one packet is lost (and each frame is coded in a single slice) the rest of that frame will be lost, since the last packets cannot be decoded.

What I would like to have is the functionality of setting a max size for a slice (in my case 1400) and that the encoder starts on a new slice when the limit is reached. If each packet contains one slice a packet-loss will only affect that slice and the rest o the frame can be decoded properly. Note! This is not about adding slices for the purpose of multi-threading!

My questions are:

Has anything like this been done in x264?
Do anyone have an idea of how much work is required and can anyone give me hints on where in the source code the changes should be made (and how)?
Or is it maybe something that one of the developers could implement without to much effort?
Last question, if this functionality is added, will it be adopted to the source code?

Thank you in advance, Jonatan
jonatan is offline   Reply With Quote
Old 23rd March 2009, 10:22   #2  |  Link
Gabriel_Bouvigne
L.A.M.E. developer
 
Gabriel_Bouvigne's Avatar
 
Join Date: Dec 2001
Location: Paris - France
Posts: 276
I think that there is a patch which was sent on the mailing list to do this.

Now, regarding the error-resilience of such scheme:
Let's say you have 4 slices (abcd) per frame, and on frame 0 we are loosing slice b. What will happen for slices abc of frame 1 which are referencing b0?
You won't be able to decode them properly, so you in fact lost ability to properly decode b0, a1, b1, c1. And now, what about frame 2 which is referencing frame 1?

All this to say that if you want slices for error resilience, you'd better:
*using I frames only or
*be able to restrict mv to slice boundaries or
*have a smart decoder and use constraint_intra_pred flag
Gabriel_Bouvigne is offline   Reply With Quote
Old 23rd March 2009, 10:27   #3  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by Gabriel_Bouvigne View Post
I think that there is a patch which was sent on the mailing list to do this.

Now, regarding the error-resilience of such scheme:
Let's say you have 4 slices (abcd) per frame, and on frame 0 we are loosing slice b. What will happen for slices abc of frame 1 which are referencing b0?
You won't be able to decode them properly, so you in fact lost ability to properly decode b0, a1, b1, c1. And now, what about frame 2 which is referencing frame 1?

All this to say that if you want slices for error resilience, you'd better:
*using I frames only or
*be able to restrict mv to slice boundaries or
*have a smart decoder and use constraint_intra_pred flag
And given the absurd cost in bits of those options, you're better off just encoding normally and using FEC.
Dark Shikari is offline   Reply With Quote
Old 23rd March 2009, 11:30   #4  |  Link
jonatan
Registered User
 
Join Date: Mar 2009
Posts: 5
Thing is, I will have low-delay requirements so resending is not an option neither is periodic Intra frames since it will add delay and cost to much or reduce quality, and the characteristics of the network are not known from start and can change in time, so just using FEC is not reliable enough (or will cost to much). However, feedback is possible so the encoder will know (like a second later) that a packet ha been lost and can then repair it with an Intra picture or constrained Intra macroblocks. Nevertheless I do want the quality to be as good as possible in the meantime, and I do want the repair to be as cheap as possible and that's why I need slices.

/ Jonatan
jonatan is offline   Reply With Quote
Old 23rd March 2009, 11:31   #5  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by jonatan View Post
]Nevertheless I do want the quality to be as good as possible in the meantime, and I do want the repair to be as cheap as possible and that's why I need slices.
Slices don't change the fact that if you lose a packet, every single frame until the next IDR frame will be corrupted.
Dark Shikari is offline   Reply With Quote
Old 23rd March 2009, 11:36   #6  |  Link
jonatan
Registered User
 
Join Date: Mar 2009
Posts: 5
Quote:
Slices don't change the fact that if you lose a packet, every single frame until the next IDR frame will be corrupted.
No, but there is a huge difference if each frame looks crappy allover, or if it's just 10% of the picture area that looks bad.
jonatan is offline   Reply With Quote
Old 23rd March 2009, 11:39   #7  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by jonatan View Post
No, but there is a huge difference if each frame looks crappy allover, or if it's just 10% of the picture area that looks bad.
But again, unless you restrict motion vectors to within slice boundaries, which significantly hurts compression, the picture will progressively degrade from 10% destroyed to 100% destroyed quite quickly.
Dark Shikari is offline   Reply With Quote
Old 23rd March 2009, 11:47   #8  |  Link
jonatan
Registered User
 
Join Date: Mar 2009
Posts: 5
Quote:
But again, unless you restrict motion vectors to within slice boundaries, which significantly hurts compression, the picture will progressively degrade from 10% destroyed to 100% destroyed quite quickly.
That depends on the motion in the sequence and anyway, a progressive degradation is way much better than an instant destruction.
jonatan is offline   Reply With Quote
Old 23rd March 2009, 12:32   #9  |  Link
Gabriel_Bouvigne
L.A.M.E. developer
 
Gabriel_Bouvigne's Avatar
 
Join Date: Dec 2001
Location: Paris - France
Posts: 276
In some cases, slices with error feedback and restricted MV make sense (ex: videoconf over low bandwidth channel).
Restricted MV will hurt compression, but likely less than in "natural" sequences.
Gabriel_Bouvigne is offline   Reply With Quote
Old 23rd March 2009, 13:49   #10  |  Link
jonatan
Registered User
 
Join Date: Mar 2009
Posts: 5
Quote:
I think that there is a patch which was sent on the mailing list to do this.
How can I find this patch?
jonatan is offline   Reply With Quote
Old 23rd March 2009, 16:25   #11  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
Quote:
Originally Posted by Gabriel_Bouvigne View Post
In some cases, slices with error feedback and restricted MV make sense (ex: videoconf over low bandwidth channel).
Restricted MV will hurt compression, but likely less than in "natural" sequences.
In theory yes. But for most content, there isn't that much vertical motion. I'm always surprised by how little difference it makes in practice with typical content.

Now, a pogo-stick championship shot hand-held...
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Reply


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 13:33.


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