Video (MP4) playback issue

Nextcloud version: 27.1.2, self hosted
Operating system and version : OpenSUSE Leap 15.5
Apache or nginx version: 2.4.51
PHP version: 8.2.17

The issue you are facing:
I’ve some videos, mainly recorded by smartphones, mp4, which are playing fine inside Nextcloud, so usually it works. But now I have a mp4 which I need to share via Nextcloud, unfortunately does not play. Error msg is (translated from German) “error during loading of [file name]”
File could be downloaded from Nextcloud, plays fine offline then, so file integrity is not an issue.
Tried with Firefox on OpenSUSE, also MS Edge on Win 10, same behavior, still not sure if Browser codecs etc. settings might be the problem, not Nextcloud.

Hints would great :slight_smile:

Tried with a “tail -f nextcloud.log”, server side, but nothing seems to be logged when error happens.

Is this the first time you’ve seen this error? >

Steps to replicate it:

  1. Upload and (try to) play a mp4 video inside Nextcloud

What is the output of

ffmpeg -hide_banner -i filename.mp4

Whenever a Nextcloud Video doesn’t play in the browser, I’ve been able to solve it by using Google Chrome browser. Maybe this works for you, too. Though ofc. it doesn’t solve the underlying issue that some videos don’t like being played inside Firefox for whatever reason that’s beyond my understanding.

Did, hopefully correct “react” as only three thumbs ups now?

$> ffmpeg -hide_banner -i 0000000620600000000.mp4 
[mp2 @ 0x562f182a3740] Header missing
    Last message repeated 26 times
[mpeg @ 0x562f18280480] decoding for stream 1 failed
[mpeg @ 0x562f18280480] Could not find codec parameters for stream 1 (Audio: mp2, 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpeg, from '0000000620600000000.mp4':
  Duration: 00:00:15.32, start: 66734.674000, bitrate: 14960 kb/s
    Stream #0:0[0x1e0]: Video: h264 (High), yuvj420p(pc, bt709, progressive), 2560x1440, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 0 channels, s16p
At least one output file must be specified

@Sanook vlc’s “codec” output:

@NextMeIsOnline Tried with chromium on OpenSUSE, which even crashes completely when trying … Tried again on Windows also: Edge, Chromium, Firefox: Same error.

FYI: Tried to open file via Firefox directly, error msg is (translated from German): “No video with supported format and MIME type found”

That might be the problem.Your browsers can’t decode the videocodec h264 (which is strange) - try to enable plugin openh264 in your ff.

You can also look at the video properties with Mediainfo.

Looks like the video is not saved correctly, but you can try to transcode it with ffmpeg, for example:

ffmpeg -hide_banner -i input.mp4  -c:v h264 -b:v 15M -c:a aac -b:a 128k output.mp4

It’s enabled, of course :smiley:
And, as said, it doesn’t work in all browsers I’ve tried, both on Windows and Linux.

mediainfo’s output for the “culprit”:

General
Complete name                            : 0000000620600000000.mp4
Format                                   : MPEG-PS
File size                                : 27.3 MiB
Duration                                 : 15 s 36 ms
Overall bit rate                         : 15.2 Mb/s
FileExtension_Invalid                    : mpeg mpg m2p vob vro pss evo

Video
ID                                       : 224 (0xE0)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L5
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 1 frame
Format settings, GOP                     : M=1, N=3
Duration                                 : 15 s 36 ms
Bit rate                                 : 14.8 Mb/s
Width                                    : 2 560 pixels
Height                                   : 1 440 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Stream size                              : 26.6 MiB (97%)
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 192 (0xC0)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Format settings                          : Joint stereo / Intensity Stereo + MS Stereo / Reserved
Duration                                 : 12 s 360 ms
Bit rate mode                            : Constant
Bit rate                                 : 96.0 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 32.0 kHz
Frame rate                               : 27.778 FPS (1152 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -286 ms
Stream size                              : 145 KiB (1%)

Text
ID                                       : 189 (0xBD)
Format                                   : RLE
Format/Info                              : Run-length encoding
Duration                                 : 14 s 956 ms

And also for another video, which plays fine inside Firefox:

General
Complete name                            : /Vortrag.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/mp42)
File size                                : 264 MiB
Duration                                 : 1 h 28 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 416 kb/s
Frame rate                               : 25.000 FPS
Encoded date                             : 2013-02-05 10:35:08 UTC
Tagged date                              : 2013-02-05 10:35:08 UTC
gsst                                     : 0
gstd                                     : 5319110
gssd                                     : BADC21261HH1380035108929057
gshh                                     : r2---sn-4g57ln7z.c.youtube.com

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Constrained Baseline@L3
Format settings                          : 1 Ref Frames
Format settings, CABAC                   : No
Format settings, Reference frames        : 1 frame
Format settings, GOP                     : M=1, N=60
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 h 28 min
Bit rate                                 : 318 kb/s
Maximum bit rate                         : 2 127 kb/s
Width                                    : 640 pixels
Height                                   : 360 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.055
Stream size                              : 201 MiB (76%)
Encoded date                             : 1970-01-01 00:00:00 UTC
Tagged date                              : 2013-02-05 10:35:14 UTC
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 h 28 min
Bit rate mode                            : Variable
Bit rate                                 : 96.0 kb/s
Maximum bit rate                         : 102 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 60.9 MiB (23%)
Title                                    : IsoMedia File Produced by Google, 5-11-2011
Encoded date                             : 2013-02-05 10:35:12 UTC
Tagged date                              : 2013-02-05 10:35:14 UTC

Eye-catching difference for me is this line:

FileExtension_Invalid                    : mpeg mpg m2p vob vro pss evo

Not sure what it means, as, as shown before, VLC says it is a H.264 codec based video… confused. Nevertheless… to further test I’ve created a hard link with extension .mpeg and tried with Firefox: Firefox now asks how to open, save locally or open directly in the default player, suffix based, typical “Download file” dialogue. VLC and other players works also fine with the other suffix.

Tried, runs for a while, slow machine :), produces tons of errors like this:

[mp2 @ 0x55c3c9279080] Header missing
Error while decoding stream #0:1: Invalid data found when processing input

and finishes with error.

(Still) Confused, as VLC etc. plays without problems

The “culprit” is not well formatted.

It has the format “MPEG-PS” instead of “MPEG-4”

Propably the file can be transcoded with the new version of ffmpeg “7.0 Dijkstra”?
Or Handbrake?