TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Raspbian Buster video decoding problems

Mon Sep 30, 2019 1:34 pm

Hello everyone!

I have the Raspberry Pi 4B 4GB model. With the latest release version of Raspbian Buster installed.
I faced the issue with video encoding in VLC. Each video file, I tried to open, is playing with green artifacts. The same issue happens in Kodi as well.
But it's not happened when I launching LibreELEC Kodi version. It plays videos without any problems.

Regarding configuration:
- I have original type-c power supply for Raspberry.
- 16 GB sd card with Raspbian.
- 320 MB of RAM allocated for video.
- I used external 2.5" HDD over USB 3.0 with additional power supply for it. It formatted into NTFS. And video files located on it.

Can anyone help me with it, please? If need additional information, I will provide it in posts below.

User avatar
Pulsar33
Posts: 102
Joined: Sun Aug 25, 2019 4:06 pm
Location: Bordeaux France

Re: Raspbian Buster video decoding problems

Mon Sep 30, 2019 2:11 pm

Hello,

All this seems correct. Can you post here the Mediainfo Text description of a video file that has the problem ?

Regards
Pulsar33
Pi 4 with 4Gb memory, DVB TV pHAT ------------------- Desktop : Core i5 Linux MINT 19.2

TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Re: Raspbian Buster video decoding problems

Mon Sep 30, 2019 8:14 pm

Pulsar33 wrote:
Mon Sep 30, 2019 2:11 pm
Hello,

All this seems correct. Can you post here the Mediainfo Text description of a video file that has the problem ?

Regards
Pulsar33
Thank you for your reply.

Here are media information for a few videos:
Stream 0:
  • Codec: H264 - MPEG-4 AVC (part 10) (avc1)
  • Video resolution: 1280x720
  • Frame rate: 23.976014
  • Decoded format: this field was empty, but this is mkv file
Stream 1:
  • Codec: A52 Audio (aka AC3) (a52 )
  • Sample rate: 48000 Hz
  • Bits per sample: 32
Stream 0:
  • Codec: H264 - MPEG-4 AVC (part 10) (avc1)
  • Video resolution: 854x480
  • Frame rate: 23.976014
  • Decoded format: this field was empty, but this is mp4 file
Stream 1:
  • Codec: MPEG AAC Audio (mp4a)
  • Sample rate: 48000 Hz
  • Bits per sample: 32
I hope it will clarify the situation.

User avatar
Pulsar33
Posts: 102
Joined: Sun Aug 25, 2019 4:06 pm
Location: Bordeaux France

Re: Raspbian Buster video decoding problems

Mon Sep 30, 2019 11:47 pm

No, sorry.
Here is an example of Mediainfo Text description :

Code: Select all

General
ID                                       : 1 (0x1)
Complete name                            : /home/pulsar33/Vidéos/The Bay - Saison 1 Episode 5_France 2_2019_09_30_21_10.ts
Format                                   : MPEG-TS
File size                                : 495 MiB
Duration                                 : 44 min 54 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 542 kb/s

Video
ID                                       : 256 (0x100)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L3.1
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=1, N=50
Codec ID                                 : 27
Duration                                 : 44 min 54 s
Width                                    : 1 024 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : Zencoder Video Encoding System
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format version                           : Version 4
Format profile                           : LC
Muxing mode                              : ADTS
Codec ID                                 : 15
Duration                                 : 44 min 54 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy

Menu
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
Duration                                 : 44 min 54 s
List                                     : 256 (0x100) (AVC) / 257 (0x101) (AAC)
Service name                             : Service01
Service provider                         : FFmpeg
Service type                             : digital television

BR
Pulsar33
Pi 4 with 4Gb memory, DVB TV pHAT ------------------- Desktop : Core i5 Linux MINT 19.2

TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Re: Raspbian Buster video decoding problems

Tue Oct 01, 2019 9:02 am

Pulsar33 wrote:
Mon Sep 30, 2019 11:47 pm
No, sorry.
Oh, I got it. I used VLC to check it.

Here is infomation for the first file:

Code: Select all

General
Unique ID                                : 212368185228102838204297644888192739631 (0x9FC49FED6D4CF2F18A8C42280F60692F)
Complete name                            : The X-Files.s01e01.Pilot.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 1.42 GiB
Duration                                 : 47 min 42 s
Overall bit rate                         : 4 259 kb/s
Encoded date                             : UTC 2015-04-05 11:49:30
Writing application                      : mkvmerge v6.4.1 ('Omega Point') built on Sep 16 2013 22:05:10
Writing library                          : libebml v1.3.0 + libmatroska v1.4.1

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 9 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 9 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 47 min 42 s
Bit rate                                 : 3 790 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.172
Stream size                              : 1.26 GiB (89%)
Writing library                          : x264 core 138 r2358 9e941d1
Encoding settings                        : cabac=1 / ref=9 / deblock=1:-3:-3 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=7 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=22 / scenecut=40 / intra_refresh=0 / rc=crf / mbtree=0 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:0.80
Default                                  : Yes
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 47 min 42 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 65.5 MiB (5%)
Title                                    : 1+1
Language                                 : Ukrainian
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 47 min 42 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 65.5 MiB (5%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

And the second one:

Code: Select all

General
Complete name                            : Friends.s01e01(001).480p.BDRip-AVC.Ukr.hurtom.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/isom/avc1)
File size                                : 228 MiB
Duration                                 : 22 min 49 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 399 kb/s
Encoded date                             : UTC 2012-12-11 20:17:50
Tagged date                              : UTC 2012-12-11 21:23:19
Writing application                      : HandBrake 0.9.8 2012071700

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 6 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 6 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 22 min 48 s
Bit rate                                 : 81.6 Mb/s
Nominal bit rate                         : 1 300 kb/s
Width                                    : 854 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 23.976 (24000/1001) FPS
Minimum frame rate                       : 23.974 FPS
Maximum frame rate                       : 23.981 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 8.303
Stream size                              : 13.0 GiB
Writing library                          : x264 core 120
Encoding settings                        : cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=40 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=10 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1300 / ratetol=1.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Encoded date                             : UTC 2012-12-11 20:17:50
Tagged date                              : UTC 2012-12-11 21:23:19
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 22 min 49 s
Bit rate mode                            : Variable
Bit rate                                 : 96.0 kb/s
Maximum bit rate                         : 168 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 15.6 MiB (7%)
Title                                    : Stereo
Language                                 : Ukrainian
Encoded date                             : UTC 2012-12-11 20:17:50
Tagged date                              : UTC 2012-12-11 21:23:18

Rascas
Posts: 543
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Raspbian Buster video decoding problems

Tue Oct 01, 2019 9:33 am

Upload a sample of the video for us to test.

User avatar
Pulsar33
Posts: 102
Joined: Sun Aug 25, 2019 4:06 pm
Location: Bordeaux France

Re: Raspbian Buster video decoding problems

Tue Oct 01, 2019 10:23 am

Seems to be a problem with mkv container. I suppose you have something like that :
mkvGarbage.jpg
mkvGarbage.jpg (35.75 KiB) Viewed 532 times
I've the same with some video. Simple recoding with codec copy fails. I suggest you to recode with something like that :

Code: Select all

ffmpeg -i YourFile.mkv -threads 0 -f mp4 -vcodec mpeg4 -filter:v yadif=0:-1:1 -maxrate 4000k -b:v 2000k -qmin 3 -qmax 5 -bufsize 8000k -strict experimental -acodec aac -async 4 -ar 48000 -b:a 192k -ac 2 -vf scale=1280:720 -aspect 16:9 YourFile.mp4
Good luck
Pulsar33
Pi 4 with 4Gb memory, DVB TV pHAT ------------------- Desktop : Core i5 Linux MINT 19.2

TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Re: Raspbian Buster video decoding problems

Tue Oct 01, 2019 7:56 pm

Rascas wrote:
Tue Oct 01, 2019 9:33 am
Upload a sample of the video for us to test.
Pulsar33 wrote:
Tue Oct 01, 2019 10:23 am
Seems to be a problem with mkv container.

If you have an extra 3 GB of traffic you can check these video files.
GDRIVE LINK

I think, I found the cause of these glitches.
As I tried to copy the file from HDD to USB stick through the raspberry, to clip it using my windows machine, I tried to play it. And I faced the same glitches on Windows 10.
After, I tried different scenarios copying files:
HDD in 2.0 USB -> USB stick in 2.0 USB - in this case, everything is okay.
HDD in 2.0 USB -> USB stick in 3.0 USB - in this case, everything is okay, as well.
HDD in 3.0 USB -> USB stick in 2.0 USB - but this scenario ,
HDD in 3.0 USB -> USB stick in 3.0 USB - and this scenario has problems during reading data from HDD.

So the file in folder 33, I shared on GDrive, was copied using two 3.0 USB ports. You can see that the file is corrupted.
And the file in folder 22 was copied using two 2.0 USB ports. And this file is not corrupted.

So I think this is the solution.
For avoiding glitches in videos, required to connect the drive through 2.0 USB port, because, for some reason, 3.0 USB ports causing problems in the data stream.

User avatar
Pulsar33
Posts: 102
Joined: Sun Aug 25, 2019 4:06 pm
Location: Bordeaux France

Re: Raspbian Buster video decoding problems

Tue Oct 01, 2019 10:06 pm

Your conclusion is frightening if it's true. I will make transfer tests because I cannot be satisfied with a computer that makes data transfer errors without reporting it.

I honestly hope you're wrong.
Pulsar33
Pi 4 with 4Gb memory, DVB TV pHAT ------------------- Desktop : Core i5 Linux MINT 19.2

Rascas
Posts: 543
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Raspbian Buster video decoding problems

Tue Oct 01, 2019 10:11 pm

I didn't test the videos yet, I will test it tomorrow. There was some issues with disks in USB 3.0 case enclosure/adapters, it could be it. It was fixed trough a firmware upgrade, search the forum for "VLI firmware".

Rascas
Posts: 543
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Raspbian Buster video decoding problems

Wed Oct 02, 2019 3:48 pm

TomoeMikage wrote:
Tue Oct 01, 2019 7:56 pm
Rascas wrote:
Tue Oct 01, 2019 9:33 am
Upload a sample of the video for us to test.
Pulsar33 wrote:
Tue Oct 01, 2019 10:23 am
Seems to be a problem with mkv container.

If you have an extra 3 GB of traffic you can check these video files.
GDRIVE LINK

I think, I found the cause of these glitches.
As I tried to copy the file from HDD to USB stick through the raspberry, to clip it using my windows machine, I tried to play it. And I faced the same glitches on Windows 10.
After, I tried different scenarios copying files:
HDD in 2.0 USB -> USB stick in 2.0 USB - in this case, everything is okay.
HDD in 2.0 USB -> USB stick in 3.0 USB - in this case, everything is okay, as well.
HDD in 3.0 USB -> USB stick in 2.0 USB - but this scenario ,
HDD in 3.0 USB -> USB stick in 3.0 USB - and this scenario has problems during reading data from HDD.

So the file in folder 33, I shared on GDrive, was copied using two 3.0 USB ports. You can see that the file is corrupted.
And the file in folder 22 was copied using two 2.0 USB ports. And this file is not corrupted.

So I think this is the solution.
For avoiding glitches in videos, required to connect the drive through 2.0 USB port, because, for some reason, 3.0 USB ports causing problems in the data stream.
Just tested the files, the 33 one is corrupted, it has artifacts. Reproducible in the Raspberry Pi and a x86 PC. The 22 is good, plays nice everywhere.

TomoeMikage
Posts: 8
Joined: Fri Sep 13, 2019 2:10 pm

Re: Raspbian Buster video decoding problems

Wed Oct 02, 2019 8:42 pm

Rascas wrote:
Tue Oct 01, 2019 10:11 pm
I didn't test the videos yet, I will test it tomorrow. There was some issues with disks in USB 3.0 case enclosure/adapters, it could be it. It was fixed trough a firmware upgrade, search the forum for "VLI firmware".
Isn't "VLI firmware" a part of Raspbian? Should it be installed or updated separately from the OS?
Rascas wrote:
Wed Oct 02, 2019 3:48 pm
Just tested the files, the 33 one is corrupted, it has artifacts. Reproducible in the Raspberry Pi and a x86 PC. The 22 is good, plays nice everywhere.
Yes, as I mentioned previously. File from folder 33 is corrupted. By the way, I tried to open these files by the web interface of Google Drive and glitches are present as well.

Return to “Raspbian”