MP4 parameters?

Now that I have OSMC I’ve been dusting off some old DVDs, ripping them into MP4 files, and making them available to watch via OSMC. Great!

Well the thing is its mostly worked fine, but I’ve hit a show (3rd Rock from the Sun) where every episode plays for a minute or two, halts, plays, halts, plays. Just for grins I tried ripping with a different program and voila! The episodes play without halts. Both are MP4, coming from the same sever, same drive, etc.

Obviously the two programs have some different parameter in the MP4 encoding. The ones that play are slightly larger files. Any ideas what parameter I should look at to adjust to ensure I always get a stutter free rip? Frame rate? Bit rate? Is there a “sweet spot” that I should target?

thanks, Larry

MP4 is a container not an encoding format so your question can not be answered in that manner!

Okay, both are encoding H.264. There has to be a parameter on the one that stutters that is too high or too low. What should I try to adjust?

Compare them with mediainfo.

It would be good if we could find out more about the file you are having issues playing. Please see the mediainfo section in How to submit a useful support request - General - OSMC

From the file that stutters:
General
Complete name : H:\Store\TV\3rd Rock from the Sun\S01\3rd Rock from the Sun - S01E01 - Brains and Eggs.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (mp42/isom/avc1)
File size : 255 MiB
Duration : 21 min 52 s
Overall bit rate mode : Variable
Overall bit rate : 1 632 kb/s
Movie name : 3rd Rock From the Sun - S01E01 - Brains and Eggs
Album : 3RD_ROCK_S1D1
Encoded date : UTC 2017-04-10 23:03:24
Tagged date : UTC 2017-04-10 23:06:26
Writing application : DVDFab 10.0.3.2
covr : Unknown kind of value!

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Format settings, GOP : M=1, N=24
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 21 min 52 s
Bit rate mode : Variable
Bit rate : 1 494 kb/s
Maximum bit rate : 2 263 kb/s
Width : 632 pixels
Height : 476 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.166
Stream size : 234 MiB (92%)
Encoded date : UTC 2017-04-10 23:03:24
Tagged date : UTC 2017-04-10 23:06:26
Color primaries : BT.601 NTSC
Transfer characteristics : BT.709
Matrix coefficients : BT.601
Menus : 3

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 21 min 52 s
Bit rate mode : Variable
Bit rate : 128 kb/s
Maximum bit rate : 132 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 spf)
Compression mode : Lossy
Stream size : 20.0 MiB (8%)
Title : English (aac 2.0)
Language : English
Default : Yes
Alternate group : 1
Encoded date : UTC 2017-04-10 23:03:24
Tagged date : UTC 2017-04-10 23:06:25

Menu
ID : 3
Codec ID : text
Duration : 21 min 52 s
Encoded date : UTC 2017-04-10 23:03:24
Tagged date : UTC 2017-04-10 23:06:26
Bit rate mode : CBR
Menu For : 1
Duration_FirstFrame : 1309475
00:00:00.000 : Chapter 1
00:21:51.143 : Chapter 2

From the one that plays:
General
Complete name : H:\Store\TV\3rd Rock from the Sun\S04\3rd Rock from the Sun - S04E01 - Dr Soloman’s Traveling Alien Show.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 339 MiB
Duration : 22 min 6 s
Overall bit rate mode : Variable
Overall bit rate : 2 140 kb/s
Movie name : 3rd Rock from the Sun: Season 4 [4 Discs]
Album : 3rd Rock from the Sun: Season 4 [4 Discs]
Genre : Comedy
Recorded date : 2006
Encoded date : UTC 2017-06-10 03:25:50
Tagged date : UTC 2017-06-10 03:25:50
Writing application : Lavf51.12.1
Copyright : Anchor Bay

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L1.3
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=12
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 22 min 6 s
Bit rate : 2 008 kb/s
Width : 720 pixels
Height : 540 pixels
Display aspect ratio : 4:3
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.215
Stream size : 318 MiB (94%)
Encoded date : UTC 2017-06-10 03:25:50
Tagged date : UTC 2017-06-10 03:25:50

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 22 min 6 s
Bit rate mode : Variable
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 spf)
Compression mode : Lossy
Stream size : 20.2 MiB (6%)
Encoded date : UTC 2017-06-10 03:25:50
Tagged date : UTC 2017-06-10 03:25:50

I see a LOT differences, way more than I thought.

Welcome to the world of encoding :slight_smile:

Where are you playing the files from? Over network? Using wired/wireless? NFS/SMB?

Can you try playing the problematic file locally (copy to sdcard or directly attached USB stick)?
We can then rule out any network issues if it still stutters.

Both sets of files are on a USB drive attached to a Windows PC that is SMB shared to the RPi over my Wifi.

I was, at first, thinking it was some form of problem with the Windows PC being busy, or Wifi not delivering consistently — but when the one file plays fine and the other stutters - both over the otherwise same conditions, it kinda points to something different in the encoding.

Please try playing the file locally.

Bit rate isn’t always uniform. The file with lower average bitrate may have higher peaks.

Okay, tried that and indeed from a USB stuck into the RPi it does play fine.

I don’t get what this says then. One version “travels” better?

In general when encoding a video you can choose between constant bitrate or constant quality.
Constant bitrate will transfer better over low bandwidth channels (e.g. ropey wifi or internet),
but it wastes bits on simple frames and lowers quality on complex frames.

Constant quality is generally the better option, but you can get large spikes in bitrate for frames that are hard to compress.
This includes frames with lots of movement and detail, and also random noise (the HBO intro is a good example. Rain, water, grass, crowds are other examples).

Ideally don’t use wifi for video. An ethernet cable will always give a much better experience.
If you can’t do that, homeplugs are often successful.
If not, you need to maximise your wifi signal. Use a phone app to monitor channels and choose the one with least interference from neighbours. Try moving around the two ends of wifi link. Make sure there is minimum of obstacles (especially metal) between the two ends.

You can also increase the video cache which may help:
http://kodi.wiki/view/HOW-TO%3AModify_the_video_cache
(make sure you follow the v17 instructions).

Both ends, the WIndows PC and the RPi are within feet of their respective Wifi APs, they’re getting a very good signal, I’m using a Netgear Orbi system, which I bought because it ranked very high on thruput.

And I’m sorry but while very informative your answer doesn’t help my question: what is it about the one encoding program that results in a playable file that the other produces a stuttering file.

Why not just use the one that produces the “good” file? It can only process DVD’s and sometimes I need to process a Bluray. The other program reads DVDs and Blurays so I really need to know what to adjust in that program to be sure I get playable files when sent over wifi.

thanks, Larry

So you bought on top of the line router and using a rpi that has ethernet thats using the usb speeds on lan

Internal LAN (10/100): 94.4 Mbits/sec (11.8 MB/sec)
USB 802.11n WiFi: 44.5 Mbits/sec (5.6 MB/sec)
USB Gigabit LAN (10/100/1000): 321 Mbits/sec (40 MB/sec)

again im sure that the orbi is up to the task the question is the rpi

Can you explain exactly the setup.
Is the Pi using wifi to connect to AP? Is this Pi3 with onboard wifi or a wifi dongle?
If it is only a few feet from AP can you connect an ethernet cable?

I bought a mesh wifi system because I have a LOT of devices over a large area. I picked Orbi because it had the best speed/thruput. So yes I’m using a high-end wifi system and a couple cheap-ass Rpis. I explained this detail to show that its not the problem.

Again, I encoded one DVD rip with Program A, the very same DVD with Program B. The file made with Program A plays fine, the file made with Program B stutters. What parameters do I need to adjust on Program B so that it too will make a file that doesn’t stutter?

Windows PC with USB drive contains the file for playback. It is within feet of master Orbi.

RPi in bedroom using its built-in wifi and an SMB connection back to the Windows PC’s USB disks. It is on the opposite wall of the Orbi in the bedroom.

Yes, I could connect an ethernet cable but I’m not willing to do that. Why? That would be appropriate if both Program A and Program B made files that stuttered. Every other file plays except this particular DVD made with Program B. I want to adjust Program B not re-image the house.

But connecting a cable, or even better would be to copy the fles to a USB stick would help narrow down the problem. I don’t think that @popcornmix is saying to always use the cable, he’s just trying to help you find and fix the problem.

Fixed that for you. Now the answer to that would likely be found by asking the developers of Program B. This question has nothing to do with OSMC.

I did that, I copied the file to a USB, stuck the USB into the RPi and the file played fine, and reported that here.

Sorry, but I just don’t see how that helps.

Yes, ActionA, a diff of the two outputs reports dozens of differences, and while it isn’t an OSMC problem I was hoping someone here would be able spot a key difference.

Your problematic file has an average bitrate of 1.6Mbit/s.
A Pi using etthernet can play raw 3D MVC BluRay files of around 60Mbit/s.
A Pi with good wifi can play perhaps 30Mbit/s, but this may drop to perhaps 10Mbit/s when going through multiple walls.

The bitrate you are getting a way lower than what is expected. Most likely there is a problem with some part of the wifi network. I suspect if almost any other OSMC user tried to play the problematic file over their network, they would have no problem.

The obvious way to identify where the bottleneck is, is to try replacing different parts of the network with a cable. Just as an experiment to narrow down where the problem is.

You should also try installing iperf to get a more accurate measure of the network throughput.