Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

HLS: skipping forward plays audio but not video


I've just implemented JWPlayer with my server, which uses libav to autogenerate different video formats. I'm primarily interested in using JWPlayer so i can use HLS.

I'm testing with the Big Buck Bunny video in Firefox

When playing a generated HLS video the audio and video plays fine, but if I skip forward I only get audio, the video shows the last frame prior to skipping forward.

I'm guessing this is something I need to tweak in how i'm generating the video or m3u8 files, but without any diagnostics from jwplayer I'm at a loss as to where to start.

So, firstly, is there any obvious erros of mine which would cause this to happen?
If not, is there a debug log or something from jwplayer that would tell me what its not happy about?

Thanks,
Brad

11 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Do you have an example?

JW Player

User  
0 rated :

Not yet, but i can make one available...

JW Player

User  
0 rated :

Ok, here's that example:

http://idhealth-site.myspliffy.com/demo.html

Using FF, I can start watching a few seconds, then skip forward but the video remains stuck on the last video frame seen before skipping forward. Audio plays correctly

The playlists are auto-generated:
Master
http://idhealth-site.myspliffy.com/in.mp4/alt-hls.m3u8

Program ID 1 - 480x360
http://idhealth-site.myspliffy.com/in.mp4/alt-480x360.m3u8

Program ID 1 - 1024x720
http://idhealth-site.myspliffy.com/in.mp4/alt-1024x720.m3u8

The actual segments are named with the hash of their content like this:
http://idhealth-site.myspliffy.com/in.mp4/c1604f9432a874919319b8dcadddf8e73e5bb43a.ts

Paths in the program playlist files are relative.

Note that all url's are underneath the file they were generated from.

Each ts file seems to play correctly on its own, so that suggests to me that its correctly aligned with key frames.

Any thoughts?

JW Player

User  
0 rated :

Update: I've checked the JWPlayer demo page (http://www.longtailvideo.com/support/jw-player/29393/hls-adaptive-stream/) and compared the working files there with what i'm producing.

The only significant difference was the format profile (mine was Main L2.2, yours Main L3.0), but i've updated that locally and it has no effect.

I've also experimented with different options for keyframe generation but that also has had no effect.

I think it must be related to the ts files, rather then the m3u8 files, but it must be something at a pretty low level. Note that the m3u8 stream plays correctly with ffplay, including skipping forward.

If there was some logging from the player inside jwplayer that might help me to locate the problem

Remco van Bree

JW Player Support Agent  
0 rated :

I’m afraid that chances are that there is something happening in your encoding or your segmenter that breaks things on seeks, but we have seen HLS files from many sources (including Wowza, Adobe Media Server and FFmpeg 1.2) that the player works fine with, but I’m afraid we don’t have any more debug info we can help you with.

JW Player

User  
0 rated :

Could you post the ffmpeg 1.2 command you used? I could take it from there.

JW Player

User  
0 rated :

@Brad
Don't use CABAC and B-Frames

JW Player

User  
0 rated :

So this?
-coder 0 -bf 0

I'll give that a shot..

JW Player

User  
0 rated :

Perhaps I was shouting to fast.

But if your target is also older smart phones you have to stick to Baseline Level 3.0.
In this profile no B-Frames are allowed and follows a more simple coding/decoding algo.

My opinion is that ffmpeg is not the ideal tool for creating HLS compliant files. With this said I guess I wil get the over me. Perhaps we can start a thread about ffmpeg and HLS and share knowledge.

CBR.
We want a constant bitrate, at least constant as it could be, for auto bitrate switching. If not the player (JW & IOS) will flip between 2 or even stalls. I use a 3 pass encoding for flatten the peaks but is not ideal.

Keyframes.
We want keyframes at certain points (for segmentation). If you want several bitrates/sizes the keyframes are placed at different points. When a player switches to a different bitrate/size a transition can be noticed or even a stall.

For a single pass I use these options for ffmpeg (my org films have 25 frames/sec):
-y
-i "FileIn"
-f mpegts
-acodec aac
-strict experimental -b:a "BRA"
-s "Xsize"x"Ysize"
-c:v libx264
-b:v "BRV"
-r 25
-level 30 -profile:v baseline
-aspect "Xsize":"Ysize"
-maxrate "BRV"
-bufsize "BRV"
-keyint_min 25 -g 25
-refs 1
-trellis 0
"FileOut"

To see the bitrate variations and the keyframes in a fragment you can use this tool:
http://www.winhoros.de/docs/bitrate-viewer/

To analyze your settings this:
http://mediainfo.sourceforge.net/nl

Also have a closer look at your segmentation. Keyframes must be placed well!


JW Player

User  
0 rated :

Thats awesome, thanks. Works a treat. Would love to join in a chat about ffmpeg (ok, i'm actually using libav ... shhh).

I havent updated the demo in the post, but i've got it going locally and appears to work fine.

For anyone interested here's the command i ended up with, heavily influenced from the above:

avconv
-i FILE
-strict experimental
-vf scale=-1:360.0,crop=480.0:360.0
-b:v 512k
-maxrate 512k
-bufsize 512k
-b:a 64k
-r 12
-keyint_min 12
-refs 1
-trellis 0
-g 12
-profile:v baseline
-level 30
-segment_time 3
-c:v libx264
-c:a libvo_aacenc
-map 0:0
-map 0:1
-bsf h264_mp4toannexb
-flags +cgop-global_header
-f segment
-segment_list_size 99999
-segment_format mpegts
-segment_list raw480x360.m3u8
seg480x360-%03d.ts
-vf scale=-1:500,scale=-1:720.0,crop=1024.0:720.0 -b:v 1024k -maxrate 1024k -bufsize 1024k -b:a 128k -r 24 -keyint_min 25 -refs 1 -trellis 0 -g 24 -coder 0 -profile:v baseline -level 30 -segment_time 3 -c:v libx264 -c:a libvo_aacenc -map 0:0 -map 0:1 -bsf h264_mp4toannexb -flags +cgop-global_header -f segment -segment_list_size 99999 -segment_format mpegts -segment_list raw1024x720.m3u8 seg1024x720-%03d.ts

This command generates 2 sizes. I'm targeting poor bandwidth users with the 360p version so i've dropped the framerate down to 12 (but I'm still experimenting)

I've added +cgop because that seems important for HLS and I wasnt quite sure what the default is.

The nature of this application is that multi-pass encoding is probably not practical, and it needs to support live streaming where its definitely not practical!

Ethan Feldman

JW Player Support Agent  
0 rated :

Nice, thanks for sharing this!

This question has received the maximum number of answers.