B4J Question jMediaView

RichardN

Well-Known Member
Licensed User
Longtime User
I thought I would knock up a video preview prog using the jMediaView from @TILogistic.......

Unfortunately I seem to be doing something dumb. The example works fine using his URL but when I construct a URI for a local file I consistantly get the error:
file:/C:/Users/Richard/Desktop/New_Foxes/New.MP4
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
HALTED
ERROR: MediaException: PLAYBACK_HALTED : Failed to link AV parser to video bin!

The URL works but the URI does not. What am I doing wrong here?

jMediaView Example:
'Dim VideoContent As String = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"  'This line plays fine

Dim VideoContent As String = File.GetUri("C:\Users\Richard\Desktop\New_Foxes\","New.MP4")   'This one halts with error
    
Log(VideoContent)
MediaViewController1.SetMediaView(MediaView1)
MediaView1.Source = VideoContent
MediaView1.Play
 

TILogistic

Expert
Licensed User
Longtime User
B4X:
    Dim VideoURL As String = File.GetUri("C:\video\","Big_Buck_Bunny.mp4")
    
    MediaViewController1.SetMediaView(MediaView1)
    MediaView1.Source = VideoURL
    MediaView1.Play

1747187511783.png
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
Thanks @TILogistic but it appears I had already tried that code without success.

I downloaded the Big Buck Bunny video in AVC 720p-60 and it works just fine when played as a local file. However a selection of other videos of similar complexity produce either the 'Can't connect to media bin' message or an 'ERROR INVALID_MEDIA' message.

It appears the view is quite strict in the format of video it will accept. Is anyone aware of a list of valid video formats that can be used with this library?

After reading around the subject for a while it is possible that the issue (I am running Win 11) is related to the problems experienced by @bdunkleysmith in this thread
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
see:

Regarding the issue you describe and the member you mentioned, it's difficult to determine the problem if we don't have the videos that generate that error, to see their behavior and encoding.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
and you want another alternative.
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
@TILogistic Thanks for the suggestions. I have discussed the possible Win 11 issue with @bdunkleysmith but we are no closer to a cause. I have observed videos that previously played without a problem, refuse on subsequent attempts. That behaviour appears random.

By way of troubleshooting I have rendered a selection of short .mp4 clips in different AVC profiles of varying sizes and bitrate. A small example of the Video Browser app is attached. I am getting continuous refusal from clips 5 and 6 and random others intermittantly. Download the sample videos from my dropbox link and unzip to C:\videos\ to run. Then choose a video from the list.

Sample Video Clips Here
 

Attachments

  • Video Browser.zip
    2.9 KB · Views: 79
Upvote 0

teddybear

Well-Known Member
Licensed User
It seems the mediaview doesn't support h264 baseline. convert the clips 5 and 6 to h264 main with ffmpeg
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
@teddybear That is not in the Java documentation but it was my working theory.

Did you test it with the my code...... or are you just offering the same theory ?
 
Upvote 0

teddybear

Well-Known Member
Licensed User
As we know, the mediaview does not support all formats of video.
For video formats that are not supported, you can convert them with some tools.
I have converted 5 and 6, all of them can be played with your code. note using jdk14+.
 
Last edited:
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
@teddybear
It seems the mediaview doesn't support h264 baseline

Thanks for taking the time to look at this. You may have noticed that the last clip in the list is a 4k H264 Baseline coded at 20mbs which for me works just fine. That disproves the theory about Baseline. What differentiates that clip from the two that won't play remains a mystery.

I appreciate that MediaView does not support EVERY format of video, but it would be very useful to know which formats are UNsupported. There are clearly issues amongst even the most common formats of AVC but I have yet to pin the issue down. By the same token, we cannot yet rule out platform/environment/OS dependent issues.

I cannot take the time in my workflow to transcode video clips because MediaView won't play them.... Even if I knew which ones to convert! I am looking for a quick and dirty media player that will play any old input format without an enormous overhead. Clearly MediaView is not it.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
The last clip is h264 (High) not Baseline. the sample 7 is h264 (Constrained Baseline).
5 and 6 are h264 (Baseline).
I cannot take the time in my workflow to transcode video clips because MediaView won't play them....
Perhaps you need to use vlc player do do that
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
Good to see some continuing discussion on this.

I know very little about the formats of videos, but I did use Mediainfo to see if I could see differences between the videos produced for our purpose this year compared to last when I begun to encounter the random failures. I don't know what H264 refers to because I don't see that listed in the Mediainfo details, but the videos I use are a mix of Baseline, Main and High, if the "Format profile" is what this conversation is referring to.

My MediaView based app certainly has played one particular video quite reliably in the past which shows the Format profile as Baseline@L4 and so that suggests MediaView does support baseline, doesn't it?

I think both @RichardN and I want to get to the bottom of this, but @teddybear I also suggested using B4JVlcj as an alternative in the interim. But for my application, I found too much delay in the video commencing using B4JVlcj and so abandoned that. I've made many changes which have had no discernible difference (improvement), with the update from Win10 to Win11 appearing to be the main factor. So my current workaround is using an old Win10 laptop in the production environment!
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
@bdunkleysmith I believe I have solved the mystery of the unplayable videos in MediaView.

We are all aware that the mp4 container can encapsulate multiple audio streams for the same video content, for instance different language soundtracks for a movie.

You may not be aware that .mp4 can also encapsulate multiple video streams. You don't see it very often but the feature exists. By default, almost all media players (VLC for example) will play Video#1 and Audio#1 when the file is opened because normally that's all you find. VLC thereafter will let you select the desired Video/Audio track from a right mouse-click.

I took a deeper dive into the files with MediaInfo and found something unexpected. The videos that have refused to play in MediaView were encoded by a Trail Camera activated by motion. As expected the camera records the user selected format 1080p or 1296p. However it also records a second video stream, a low-res image which is probably employed as a thumbnail view for the small-screen playback on the device. As a result the file is mp4 compliant but somewhat unusual. I removed the second stream by demuxing with Avidmux to another file and it plays perfectly. Conclusion: MediaView cannot cope with files encoded with multiple streams.

Unfortunately I don't see any facility within MediaView to select a particular Video or Audio stream to negate the issue. So unless anyone has any better suggestions this appears to be the end of the road.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
I've been working on what you mentioned, but due to a lot of work in other languages, I haven't been able to finish the updates.

Note:

 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
I've not explicitly checked my video files to see if they contain multiple tracks - I assume I'd see that using Mediainfo. But @RichardN from your comment "videos that have refused to play in MediaView" perhaps we're dealing with different problems.

None of the videos used in my app have ever always "refused to play in MediaView"; they just sometimes do that and it is the random/intermittent nature of the ERROR INVALID_MEDIA being thrown since upgrading the production laptop from Win10 to Win11 which is the perplexing problem.

For our basketball games over the weekend where my app is used to display short videos of players as part of pre-game introductions, I used an old Win10 laptop I'd done a fresh OS reinstall on and all videos ran flawlessly. So that's my current workaround, but as time allows I'll continue my search for a robust Win 11 solution.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
I've not explicitly checked my video files to see if they contain multiple tracks - I assume I'd see that using Mediainfo. But @RichardN from your comment "videos that have refused to play in MediaView" perhaps we're dealing with different problems.

None of the videos used in my app have ever always "refused to play in MediaView"; they just sometimes do that and it is the random/intermittent nature of the ERROR INVALID_MEDIA being thrown since upgrading the production laptop from Win10 to Win11 which is the perplexing problem.

For our basketball games over the weekend where my app is used to display short videos of players as part of pre-game introductions, I used an old Win10 laptop I'd done a fresh OS reinstall on and all videos ran flawlessly. So that's my current workaround, but as time allows I'll continue my search for a robust Win 11 solution.
Check the installed codecs in Windows 10 and 11?
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
As suggested by @TILogistic, using System Information (msinfo32.exe) and navigating to Components > Multimedia > Video Codecs, I checked the codecs installed on my:
  • Win11 Desktop - application development machine - original Win11 build from May 2024 - Windows 11 version 24H2
  • Win11 Laptop - application production machine - upgraded from Win10 to Win11 late in 2024 (after which the problem was noted) - Windows 11 version 23H2
  • Win10 Laptop - application production machine - fresh Win10 installation & now used as workaround for problematic MediaView video errors

VersionCreation Date
CODECManufacturerWin11 DesktopWin11 LaptopWin10 LaptopWin11 DesktopWin11 LaptopWin10 Laptop
c:\windows\system32\iyuv_32.dllMicrosoft Corporation10.0.26100.115010.0.22621.110.0.19041.1
4/12/2024 10:38​
7/05/2022 15:20​
7/12/2019 20:09​
c:\windows\system32\msrle32.dllMicrosoft Corporation10.0.26100.188210.0.22621.250610.0.19041.1
4/12/2024 10:38​
4/12/2023 17:24​
7/12/2019 20:09​
c:\windows\system32\msvidc32.dllMicrosoft Corporation10.0.26100.188210.0.22621.250610.0.19041.1
4/12/2024 10:38​
4/12/2023 17:24​
7/12/2019 20:09​
c:\windows\system32\msyuv.dllMicrosoft Corporation10.0.26100.115010.0.22621.110.0.19041.1
4/12/2024 10:37​
7/05/2022 15:20​
7/12/2019 20:09​
c:\windows\system32\tsbyuv.dllMicrosoft Corporation10.0.26100.115010.0.22621.110.0.19041.1
4/12/2024 10:38​
7/05/2022 15:20​
7/12/2019 20:09​
c:\windows\system32\magicyuv.dllNot Available1.1.0.0
10/03/2017 18:25​
c:\windows\system32\vmixvivideocodec.dllvMix Video CodecNot Available
15/03/2019 22:12​

While the versions of the same codec are different on each of the two Win11 machines, presumably because I have different versions of Win11 (24H2 Vs 23H2) I see similar video errors, noting that an objective assessment is difficult due to the random/intermittent nature of the problem.

But having gathered this data, I really don't know what it means since I don't know which codecs are used by any particular application. The vMix codec was obviously installed because that laptop is also used to stream game video to YouTube. I don't know the source of the magicyuv.dll codec.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Have you tested your videos in Windows Media Player?


To find out which codecs you have installed in Windows 10 and 11.
1747758377324.png

1747758415894.png
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
Using Windows Media Player to display the codecs installed on the Win10 laptop shows exactly the same codecs, including version, as your screenshot. On the Win11 desktop it's the same, but with versions reflecting what I found using System Information (msinfo32.exe) and navigating to Components > Multimedia > Video Codecs.

Unless I can used the "old" codec dlls from the Win10 laptop on the Win11 laptop as a test, I'm unsure how this information helps me.

I have played some of my videos in Windows Media Player and they play as I expected. The same videos generally play in javafx MediaView also. It is just sometimes a video may fail when played in javafx MediaView, particularly on a Win11 machine. It is that random/intermittent failure I'm chasing the cause of.
 
Upvote 0
Top