flashls icon indicating copy to clipboard operation
flashls copied to clipboard

Unable to seek accurately with encrypted HLS package

Open sathasivam11 opened this issue 8 years ago • 1 comments

Hi Guillaume,

I am facing issues when using ACCURATE_SEEK method. When using encrypted streams I am not able to seek exactly to a given frame. I have observed that this works perfectly when the video stream is non-encrypted. However in encrypted streams, the video does not seek to certain frame addresses. This happens at only certain frames. With other frames it works fine.

I have put log messages in StreamBuffer.as just before the tags are appended to the HLSNetSstream. I am logging the AbsolutePosition value along with FlvTagType.

In the encrypted stream, I have observed:

  1. Certain video frames are missing. When the same stream is played back unencrypted these frames and logged correctly, and seeked to accurately.
  2. The order of the frames are not the same. I suspect this to be due to the decryption worker thread.

Below is the media info of source mp4 video.

General Complete name : TestVideo.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom File size : 50.0 MiB Duration : 2mn 30s Overall bit rate : 2 793 Kbps Writing application : Lavf57.25.100

Video ID : 2 Format : AVC Format/Info : Advanced Video Codec Format profile : Baseline@L3 Format settings, CABAC : No Format settings, ReFrames : 3 frames Format settings, GOP : M=1, N=15 Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 2mn 30s Bit rate : 2 500 Kbps Width : 854 pixels Height : 480 pixels Display aspect ratio : 16:9 Original display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 50.000 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.122 Stream size : 45.4 MiB (91%) Writing library : x264 core 148 r2665 a01e339 Encoding settings : cabac=0 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=15 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=15 / rc=abr / mbtree=1 / bitrate=2500 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Audio ID : 1 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 2mn 30s Bit rate mode : Constant Bit rate : 251 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 4.49 MiB (9%) Language : English

Below is the command used to create HLS package. ffmpeg -i TestVideo.mp4 -map 0 -vcodec copy -acodec copy -vbsf h264_mp4toannexb -f segment -segment_time 10 -segment_list TestVideo.m3u8 -flags -global_header TestVideo-%d.ts

Encryption command: openssl aes-128-cbc -e -in Input.ts -out Input_enc.ts -p -nosalt -K 48656C6C6F20576F726C6421 -iv 00000000000000000000000000000000"

Can you please suggest what could be the root cause for this issue

Thanks, Sathasivam

sathasivam11 avatar Mar 14 '16 10:03 sathasivam11

is it working with default KEYFRAME_SEEKING mode ?

mangui avatar Apr 14 '16 17:04 mangui