Bug #2763

RPi2 / libav / HEVC playback and MPEG2/VC1 playback without license

Added by Dean Kasabow over 4 years ago. Updated about 4 years ago.

Status:FixedStart date:07/25/2015
Priority:NormalDue date:
Assignee:Andreas Smas% Done:

100%

Category:Video playback
Target version:5.0
Found in version:4.99.46 (4.10.25) Platform:RPi

Description

@When trying to play H265/HEVC on the Raspberry Pi2 I get about 60% CPU load (spread over all 4 CPUs) and Movian reports 10ms to 38ms for decoding of a video frame (which theoretically should be enough for 23.976fps playback).

Yet, there is only audio and no video (black screen) and in the 'media properties window' one can see HEVC XXXxYYY (no VideoCore of course). I'm using Movian/Showtime on my PS3 and in recent builds with latest libav the PS3 at least shows the stuttering video, but not the case on the Raspberry Pi2.

I also noticed same black-screen issue with MPEG2 when no license is purchased:

NO MPEG2/VC1 LICENSES (no hardware decoding):
  • 704x576i MPEG2VIDEO - black screen / audio only
  • 640x480p VC1/WMV - at most one frame decoded (frozen) with audio

WITH MEPG2/VC1 LICENSES - all works fine with minimal CPU load (although sometimes you can see OMX error in the log window for live mpeg2 streams and it needs 2-3 retries to start properly with video).

HEVC - black screen (audio only) and CPU load from 40 to 80%. Tested from SMB and USB.

02:19:13.309: vp [DEBUG]:Playing 'file:///tmp/stos/media/USB-1950MB/Good Kill Sample x265.mkv', primary, resume:yes (overridden)
02:19:13.312: media [DEBUG]:Settings initialized for URL file:///tmp/stos/media/USB-1950MB/Good Kill Sample x265.mkv in folder: <unset> [file:///tmp/stos/media/USB-1950MB]
02:19:13.319: SVSYNC [DEBUG]:Set to 0s
02:19:13.324: AVSYNC [DEBUG]:Set to 0 ms
02:19:13.326: RPI [DEBUG]:Supported audio formats AC3:YES EAC3:NO DTS:NO MLP:NO AAC:NO 8ChPCM:NO
02:19:13.333: probe [DEBUG]:file:///tmp/stos/media/USB-1950MB/Good Kill Sample x265.mkv: Probed as matroska,webm
02:19:13.503: Video [DEBUG]:Starting playback of file:///tmp/stos/media/USB-1950MB/Good Kill Sample x265.mkv (matroska,webm)
02:19:13.503: Probe [DEBUG]: Stream #0: Video: hevc (Main), yuv420p, 720x304
02:19:13.503: Probe [DEBUG]: Stream #1: Audio: aac, 48000 Hz, 5.1, fltp
02:19:13.504: media [DEBUG]:Selecting track libav:1, best score 12
02:19:13.504: Media [DEBUG]:Switching to audio track libav:1
02:19:13.506: Subscanner [DEBUG]:Starting subtitle scan for Good Kill Sample x265 (imdbid:<unknown>) year:0 season:-1 episode:-1 duration:60 opensubhash:92c0e3cc83c20e80
02:19:13.507: Video [DEBUG]: Stream #0: Video: hevc (Main), yuv420p, 720x304
02:19:13.507: Video [DEBUG]:Scanning for subs in file:///tmp/stos/media/USB-1950MB/ for Good Kill Sample x265
02:19:13.513: Video [DEBUG]: Stream #0: Codec created
02:19:13.514: Video [DEBUG]: Stream #1: Audio: aac, 48000 Hz, 5.1, fltp
02:19:13.528: Video [DEBUG]: Stream #1: Codec created
02:19:13.536: audio [DEBUG]:Codec changed to aac (0x15002)
02:19:13.549: RPI [DEBUG]:Opening audio output hdmi
02:19:13.595: Audio [DEBUG]:Converting from [5.1 48000Hz fltp] to [stereo 48000Hz fltp]
02:19:13.614: opensubtitles [DEBUG]:Added 0 subtitles
02:19:13.744: Video [DEBUG]:Playback reached EOF: End of file (-1606004923)
02:19:13.793: Video [DEBUG]:Converting from yuv420p to yuv420p
02:19:14.102: Callout [DEBUG]:/home/dean/showtime/src/htsmsg/htsmsg_store.c:236 executed for 1682163us

Associated revisions

Revision c25d6d66
Added by Andreas Smas about 4 years ago

rpi: Initial work on displaying software decoded video frames on rpi

AV sync does not work yet

refs #2763

Change included in version 4.99.200

Revision dfad06d1
Added by Andreas Smas about 4 years ago

rpi: Fix AV-sync when playing software decoded video

Fixes #2763

Change included in version 4.99.513

History

#1 Updated by Andreas Smas over 4 years ago

Right.

There is no code in place right now for rendering video from software (libavcodec) decoders so this is totally expected (but still a bug)

#2 Updated by Dean Kasabow over 4 years ago

Andreas Öman wrote:

Right.

There is no code in place right now for rendering video from software (libavcodec) decoders so this is totally expected (but still a bug)

I also noticed that Movian won't play MPEG1 on RPi - I found some old mpeg-ps files with interlaced video to test the advanced-deinterlace-filter and noticed it.

Adding

case AV_CODEC_ID_MPEG1VIDEO:

just above

case AV_CODEC_ID_MPEG2VIDEO:

does the job. Then mpeg1 is processed by the videocore and no more black screen. :)

#3 Updated by Dean Kasabow over 4 years ago

in rpi_video.c:

Adding

case AV_CODEC_ID_MPEG1VIDEO:

just above

case AV_CODEC_ID_MPEG2VIDEO:

does the job.

#4 Updated by Dean Kasabow over 4 years ago

Andreas Öman wrote:

Right.

There is no code in place right now for rendering video from software (libavcodec) decoders so this is totally expected (but still a bug)

Is there a chance to add software rendering to the Pi build? I know PI-1 can't handle it, but on the Pi2 I can see other media-center apps can play HEVC/H.265 with no slowdown - I guess an overclocked Pi2 can play just fine up to HEVC Main Level 3.1 (at least 1280x720).

#5 Updated by Andreas Smas over 4 years ago

  • Target version set to 5.2

Sure, It might not make the 5.0 cut though I think.

#6 Updated by Andreas Smas about 4 years ago

  • Target version changed from 5.2 to 5.0

Changed my mind about 5.0

#7 Updated by Dean Kasabow about 4 years ago

This is great, thank you!

How far ahead is 5.0?

#8 Updated by Andreas Smas about 4 years ago

Dean Kasabow wrote:

This is great, thank you!

How far ahead is 5.0?

Hard to say, but at least one month away.

#9 Updated by Dean Kasabow about 4 years ago

Andreas Öman wrote:

Dean Kasabow wrote:

This is great, thank you!

How far ahead is 5.0?

Hard to say, but at least one month away.

It looks great in Version 4.99.202! Thanks for the effort. I can see that without the AV sync all my samples play fine (with 15 to 28ms decoding time) and one (720p) gets slowdowns, but that's only natural.

Looking forward to the next update with AV sync added.

Thanks, Andreas!

#10 Updated by Andreas Smas about 4 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Also available in: Atom PDF