MP4 Video Codec Issues


(Rob Meade) #1

Hi,

I have noticed a few of our topics don’t appear to be rendering MP4 videos recently (hosted solution). The content is embedded in a topic, and when you press play you can hear the sound, there’s just not visual.

I tried opening the URL in a separate tab and it prompts to download. I can download the video and play it (on Windows) and it appears correctly.

The only work around I have found so far is to edit the video (I used Camtasia), insert a second of “nothing” at the start of the video, then re-upload it, this forces Discourse to see the file as “new” content and for whatever reason it then seems to play.

Any thoughts on this? It’s not a one off, I’ve noticed it a few times now, but I can’t keep manually applying the work around, and it seems odd that different people would have the same issue if it wasn’t related to Discourse in some way.

Here’s a link to a topic with a video having the issue:

Here’s the link to the actual video from the topic:

Any help would be appreciated :slight_smile:


(Jeff Atwood) #2

Let’s see

http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4


(Rafael dos Santos Silva) #3

Not every container/video codec/audio codec works in the web.

Stick to mp4/h264/mp3 to get the better compatibility. Or, if you want a good experience, onebox youtube / gfycat.


(Rob Meade) #4

Hi,

Thanks for the replies.

These are MP4s though? I don’t have a lot of knowledge regarding codecs, but is it possible then that different users, perhaps using different software, would have used different codecs (unknowingly) which could result in this issue?

Interestingly, for the one which I have linked, the user has mentioned that they have managed to view it once, but it has since reverted back to just audio, whilst I have only been able to hear the audio all the way through.

Is there any way to definitely state that it is a codec issue? If so, are there any recommendations on which should be used when recording their videos (typically these are screen recordings of their games).

I’m guessing there would also then be potential differences between PC / Mac users too?

Any further info appreciated.

Also, with the above @Falco, did you copy/paste the video URL into your reply, or is that a re-recorded version of it? The reason I ask is that it plays here for me, but doesn’t on our hosted solution.

In fact, I can test that myself can’t I… I’ve grabbed the video from the URL I posted and re-uploaded it here…

…and it doesn’t seem to work - it also appears to be shorter in duration.


(Jeff Atwood) #5

The video seems fundamentally invalid / corrupt to me. I downloaded it and the detailed codec info is:

General
Format                         : MPEG-4
Format profile                 : Base Media
Codec ID                       : isom
File size                      : 654 KiB
Duration                       : 2s 84ms
Overall bit rate mode          : Constant
Overall bit rate               : 2 569 Kbps
Writing application            : Lavf57.56.100

Video
ID                             : 1
Format                         : MPEG-4 Visual
Format profile                 : Simple@L1
Format settings, BVOP          : No
Format settings, QPel          : No
Format settings, GMC           : No warppoints
Format settings, Matrix        : Default (H.263)
Codec ID                       : 20
Duration                       : 2s 84ms
Bit rate mode                  : Constant
Bit rate                       : 2 375 Kbps
Width                          : 1 920 pixels
Height                         : 1 080 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 24.000 fps
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Compression mode               : Lossy
Bits/(Pixel*Frame)             : 0.048
Stream size                    : 604 KiB (92%)
Writing library                : Lavc57.64.101

Audio
ID                             : 2
Format                         : MPEG Audio
Format version                 : Version 1
Format profile                 : Layer 3
Mode                           : Joint stereo
Mode extension                 : MS Stereo
Codec ID                       : 6B
Duration                       : 2s 16ms
Bit rate mode                  : Constant
Bit rate                       : 192 Kbps
Channel(s)                     : 2 channels
Sampling rate                  : 48.0 KHz
Compression mode               : Lossy
Stream size                    : 47.3 KiB (7%)
Writing library                : LAME3.99.5

Doing a diff on @falco’s fixed version…

Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding

vs

Codec ID                       : 20
Format settings, Matrix        : Default (H.263)

So you have a badly encoded video here, it’s not in a format browsers can display, somehow. I guess they don’t like H.263 any more. The audio comes through but not that video codec format.


(Rob Meade) #6

hmmn… this is a pain as it seems a complex topic to have to put across to a user recording their screen.

I will go back to the user in question and see if I can establish what software they were using.

Can I ask Jeff, what did you use to get the codec info? Free tool?


(Jeff Atwood) #7

I used MPC-HC x64


(Rob Meade) #8

Thanks for this, I will have a little nose at my own re-recording also and compare.

Most likely the users will want to use a free application for screen recording, I know some use the Windows Game mode app. Will have to investigate to find a couple of handy/free solutions which we can perhaps recommend.

Thanks, as always, for your help with this :slight_smile:


(Rafael dos Santos Silva) #9

I fixed the encoding using ffmpeg.

Exactly.

That’s why people should upload their video to a sharing service like, youtube, gfycat, imgur, etc.

They will take care of converting the video to a suitable format for the web. Never upload video directly to the forum, there is always a browser/OS combination that won’t be able to play it.


(Rob Meade) #10

Thanks for the reply :slight_smile:

This is something which never even crossed my mind before now. I will raise this with the powers that be and see what they suggest. So far its been a fairly small issue, but one I could see gaining more traction.

In this particular case, it would seem that the video was generated using Blender from a series of frames of animation, something else I would not have guessed initially.

Thank you all so much for your help with this, fully appreciate (now!) that this wasn’t/isn’t an issue with Discourse itself and could be an issue with any web-baseed platform potentially.

Obviously, I can’t close this one but happy for you to do so as you wish :slight_smile:


(Daniela) #11