Recover video frame from decoded data

48 views
Skip to first unread message

Ahmad Alhilal

unread,
Apr 11, 2020, 6:51:03 AM4/11/20
to steinwurf-dev
I'm working of reliable UDP-based video transmission. I found no way to recover the original video frame, As show in video Receiver last line.
Do you have an example, idea or instructions that may help?

Video Sender 
# iterate on video frames & initiate a generation for each
cap = cv2.VideoCapture('game.mp4')
while cap.isOpened():
check, frame = cap.read()

# compute symbols based on frame and symbol_size
data_in = bytearray(frame)
settings['symbol_size'] = 1400
settings['symbols'] = int(math.ceil(len(data_in)/settings['symbol_size']))

# setup kodo encoder & send settings to server side
encoder = kodo.RLNCEncoder(
field=kodo.field.binary8,
symbols=settings['symbols'],
symbol_size=settings['symbol_size'])
encoder.set_symbols_storage(data_in)

   # Encode, produce and send packets

Video Receiver
#receive the encoded packets from client side
# Setup kodo decoder
decoder = kodo.RLNCDecoder(
field=kodo.field.binary8,
symbols=settings['symbols'],
symbol_size=settings['symbol_size'])

data_out =
bytearray(decoder.block_size())
decoder.set_symbols_storage(data_out)

# Decode coded packets
..............

#Recover the original video frame
original_frame = np.frombuffer(data_out, dtype=np.dtype(int))


Thank you,
Ahmad.

Morten V. Pedersen

unread,
Apr 13, 2020, 4:51:38 PM4/13/20
to steinw...@googlegroups.com

Hi Ahmad,
Just to understand correctly. The decoder reports that it is complete - but the decoded data is not in data_out? Did I understand that correctly?

- M

--
You received this message because you are subscribed to the Google Groups "steinwurf-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to steinwurf-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/steinwurf-dev/659b3866-6c3b-4b59-8aca-efb834248f93%40googlegroups.com.

Ahmad Alhilal

unread,
Apr 13, 2020, 10:11:39 PM4/13/20
to steinwurf-dev
Hi Morten,

I found out the problem and the possible solution. 
settings['symbols'] = len(data_in)/settings['symbol_size']

The result number of symbols gives fraction like 184.4. When I round it up (using math.ceil), the encoder and decoder will code extra bytes compared to data_in 
data_in=bytearray(frame)
At the end data_out has extra bytes due to the last packet (i.e. last symbol).

Thank you,
Ahmad.
To unsubscribe from this group and stop receiving emails from it, send an email to steinw...@googlegroups.com.

Ahmad Alhilal

unread,
Jul 11, 2020, 10:33:49 AM7/11/20
to steinwurf-dev
Dear Morten,

Referring to the same problem, the decoder reports that it is complete - but the decoded data is not in data_out.
The application is reliable UDP-based frame sharing (or video transmission). When I use traffic control tool (tc) to apply packet loss, I get distorted frames. Moreover, most of received data are corrupted which hinders runing VPx decoding.

Any idea how to solve this issue?


On Tuesday, April 14, 2020 at 4:51:38 AM UTC+8, Morten V. Pedersen wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to steinw...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages