mp4 video playback

Post Reply
trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

mp4 video playback

Post by trivettegiacomo »

Hi, i'm trying to play a mp4 video on ubuntu minimal 22.04 but both kplayer and c2play crash.
Which video player should i use?

Thanks.
Giacomo :?

User avatar
odroid
Site Admin
Posts: 41850
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3427 times
Been thanked: 1915 times
Contact:

Re: mp4 video playback

Post by odroid »

Check the actual video codec format in the mp4 container.
We tested H.264 and H.265(HEVC) codec only.

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

The codec is H264. I could send the video to you if you can test it.
Thanks.
G

User avatar
odroid
Site Admin
Posts: 41850
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3427 times
Been thanked: 1915 times
Contact:

Re: mp4 video playback

Post by odroid »

Try bbb_sunflower_2160p_30fps_normal.mp4 file in this link first.
http://ftp.vim.org/ftp/ftp/pub/graphics ... ovies/BBB/

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

it doesn't work. initially it makes a small sound for 1s and then i get black screen.
G

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

perhaps try launching mpv player from terminal, like so:
mpv filename.mp4

Then, if it crashes as well, at least we'll get some feedback in the terminal.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

mvp doesn't work. you can see the error i get in the image attached.
Thanks.
G
Attachments
20231025_122403.jpg
20231025_122403.jpg (331.51 KiB) Viewed 841 times

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Oooh, because you don't have a desktop, just Ubuntu Minimal. My bad, I didn't read your post well enough.

I play videos on my Odroid M1 on Ubuntu Minimal using mpv.
Try creating a config file ~/.config/mpv/mpv.conf and add these:

Code: Select all

profile=sw-fast
vo=drm,
That comma is intentional.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Now i get this error:
Attachments
20231025_124610.jpg
20231025_124610.jpg (434.52 KiB) Viewed 836 times

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

okay then, clearly this doesn't work. Unfortunately I don't have C4 to test it on.

Perhaps it will work with a bit of Wayland?

Try installing cage (should be available on Ubuntu 22) and run:
cage mpv filename.mp4

Cage creates a Wayland desktop with nothing but a single program you wish to run on it.

Try this with a previously created config file and without it.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

tried both the cases:
Attachments
20231025_130827.jpg
20231025_130827.jpg (437.67 KiB) Viewed 831 times

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Wow, that ubuntu image must be really minimal, probably some other necessary components are missing. Like KMS. But unfortunately I don't know how to add it.

I'm sure video playback will work on desktop version of ubuntu. If this is acceptable for your case I would try that instead.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

I just need to loop a video on the screen at ubuntu startup, showing nothing else before.
Is it possible with ubuntu desktop?
Thanks

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Certainly this is possible, but I don't think I can guide you through this process, because I'd have to experiment myself.

I think that whatever your solution will be, Ubuntu Desktop will be a good start anyway. Try installing it and see if media playback even works.
Then you can switch to TTY (Ctrl+Alt+F2, for example) and try "cage" solution that we tested today.
If this works, I'm sure Ubuntu Desktop can be instructed to not load default desktop on startup and run cage instead.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Ok, i will try it and will let you know.
Thanks for now.

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

hi, i've tried with ubuntu mate 20.04 and 22.04 but both are giving errors in apt upgrade and i'm not able to install kplayer or mvp or vlc. c2play crashes.
It seems too hard for a simple job like video playback. can someone help me? i'm thinking to re-sell the odroid board.

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Sure, just show us the errors.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Now i'm not able to apt update and upgrade:
Attachments
20231025_195654.jpg
20231025_195654.jpg (419.62 KiB) Viewed 726 times

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Interesting. And what's in the file it is talking about?

Here's mine. Note it's Ubuntu 20 but shouldn't be that different.

And I wonder if your SD card isn't faulty or your method of flashing it somehow flawed.
Attachments
2023-10-25-202646_608x174_scrot.png
2023-10-25-202646_608x174_scrot.png (34.27 KiB) Viewed 721 times
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

User avatar
mad_ady
Posts: 11751
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, N2L, H2, H3+, Go, Go Advance, M1, M1S
Location: Bucharest, Romania
Has thanked: 656 times
Been thanked: 1196 times
Contact:

Re: mp4 video playback

Post by mad_ady »

trivettegiacomo wrote:Now i'm not able to apt update and upgrade:
Something similar happened to me a couple of days ago, after an interrupted update (remember, the system runs unattended upgrades periodically/after boot, so expect it to be busy after being just flashed). Anyway, in my case something decided to nuke some files in /etc/pam.d (added binary nulls at the end of text files), which caused password login/sudo to fail. ssh with keys still worked. I worked out which packages had files in /etc/pam.d (dpkg -S /etc/pam.d) and reinstalled them with config restore, and that solved the issue.

In your case I'd try to reflash, boot the system and let it be for 30 minutes. Then try to install desired packages.
Normally this shouldn't happen, but I guess we're "lucky"

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Ah yes, "unattended upgrades", the first thing I remove on a fresh Ubuntu :D
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

User avatar
odroid
Site Admin
Posts: 41850
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3427 times
Been thanked: 1915 times
Contact:

Re: mp4 video playback

Post by odroid »

Note that there is no way to playback 4K video on Desktop GUI (X11/DRM) since the Amlogic media hardware accelerator(VPU) supports only raw framebuffer.
It is the main reason why we added two media players into the minimal image only.

Anyway, we will try reproducing the issue and fining which updates broke the VPU functionality.
Give us a few days.

User avatar
odroid
Site Admin
Posts: 41850
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3427 times
Been thanked: 1915 times
Contact:

Re: mp4 video playback

Post by odroid »

I could reproduce the issue with ubuntu-22.04-4.9-minimal-odroid-c4-hc4-20220705.img.xz image.

Consider temporarily using a somewhat older OS image until we find and resolve the cause of the problem.
I've just freshly flashed ubuntu-20.04-4.9-minimal-odroid-c4-hc4-20220228.img.xz image on my C4.
c2play as well as kplayer could play well a 4K H.264 video file at least.
https://wiki.odroid.com/odroid-c4/os_im ... l/20220228

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

ok, i tried with the ubuntu minimal 20.04 and the kplayer works but the video playback isn't fluid. c2play returns an error: Segmentation fault.

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Then trying apt full-upgrade i get this error:
Attachments
20231026_140659.jpg
20231026_140659.jpg (984.74 KiB) Viewed 625 times

mdrjr
Site Admin
Posts: 11964
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 5 times
Been thanked: 110 times
Contact:

Re: mp4 video playback

Post by mdrjr »

Are you using a microsd?
Looks like several files of your Filesystem is being corrupted.
This is just one issue, the video playback one I'm looking into.

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Yes, it's not the first time there is something wrong with filesystem, and concerning updates again. Either a broken SD (which would be a terrible luck) or what @mad_ady said, interrupted update.

When you reboot your computer, you don't just unplug it from the power supply, do you?
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Hi, i will try to change the flashing app. currently i'm using balena etcher, do you know another similar app? if it doesn't work i will try also to change the sd (but it seems strange that is broken, with the raspberry it works fine). Are you sure that the os images available on odroid wiki are ok?
I reboot the c4 from command line.

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Etcher is fine, and your reboot method is sound as well.
Some RasPis were known for killing SD cards in the past, so who knows..

I can't recall anyone with similar issues, so I would guess the OS images are OK.
Trying with another SD card is the most logical step for now.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Hi, changing the sd worked for the corrupted files! Now I'm able to apt upgrade. Now is there a way to loop a video using kplayer or c2play? Thanks

User avatar
rooted
Posts: 10481
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 816 times
Been thanked: 694 times
Contact:

Re: mp4 video playback

Post by rooted »

trivettegiacomo wrote:Hi, changing the sd worked for the corrupted files! Now I'm able to apt upgrade. Now is there a way to loop a video using kplayer or c2play? Thanks
I've not tested this but it should work.

Just add it to a file (play.sh for example), make executable (chmod +x play.sh) adjust the path to the actual video file (the somefile.mp4 line), and run it (./play.sh).

Code: Select all

while true; do

if ps ax | grep -v grep | grep c2play > /dev/null
     then 
     sleep 1;

else
     for i in play;
     do
     c2play /home/user/somefile.mp4
     done
fi
done




trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Hi, i tested it but doesn't work, it creates a loop without showing the video and isn't possible to stop the process

User avatar
mad_ady
Posts: 11751
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, N2L, H2, H3+, Go, Go Advance, M1, M1S
Location: Bucharest, Romania
Has thanked: 656 times
Been thanked: 1196 times
Contact:

Re: mp4 video playback

Post by mad_ady »

Try the simpler version:

Code: Select all

while true; do
c2play /path/to/video.mp4
done
after making sure that c2play /path/to/video.mp4 works once.

User avatar
rooted
Posts: 10481
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 816 times
Been thanked: 694 times
Contact:

Re: mp4 video playback

Post by rooted »

You wanted it to loop :)

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

Hi, it doesn't work because it shows the shell black screen printing some c2play starting lines between the video executions, so the video loop is not fluid

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

Sounds like the easiest thing to do is to add "loop" option to c2play code, to assure fluent looping.
I assume mpv or kplayer will not work with HW acceleration?
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

ok for c2play, but how can i do that? i tried also with kplayer but the result was the same

User avatar
mctom
Posts: 3518
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S
Location: Gdańsk, Poland
Has thanked: 496 times
Been thanked: 668 times
Contact:

Re: mp4 video playback

Post by mctom »

c2play has been written by @crashoverride, he may be able to help you, if you know C++.
Here's source code: https://github.com/OtherCrashOverride/c2play

if mpv works in normal playback, it has a looping feature. I don't think you've tried that on the new OS image.

mpv --loop=inf file_name.mp4
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

ok thanks, i will try to use mpv, i'm not able to edit the c2play source code.

mdrjr
Site Admin
Posts: 11964
Joined: Fri Feb 22, 2013 11:34 pm
languages_spoken: english, portuguese
ODROIDs: -
Location: Brazil
Has thanked: 5 times
Been thanked: 110 times
Contact:

Re: mp4 video playback

Post by mdrjr »

with c2play you can try -l option for infinite loop

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

hi, c2play -l shows a black screen between the executions and the result is not fluid. I tried also with mpv but is really slow and the end of the execution it shows the warning in the image below
Attachments
20231101_224645.jpg
20231101_224645.jpg (258.93 KiB) Viewed 352 times

User avatar
rooted
Posts: 10481
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 816 times
Been thanked: 694 times
Contact:

Re: mp4 video playback

Post by rooted »

A black screen for how long?

User avatar
odroid
Site Admin
Posts: 41850
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3427 times
Been thanked: 1915 times
Contact:

Re: mp4 video playback

Post by odroid »

Note that 'mpv' can't utilize the VPU hardware acceleration.

User avatar
mad_ady
Posts: 11751
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, N2L, H2, H3+, Go, Go Advance, M1, M1S
Location: Bucharest, Romania
Has thanked: 656 times
Been thanked: 1196 times
Contact:

Re: mp4 video playback

Post by mad_ady »

Disclainer: I'm not a C programmer, haven't looked at the code, etc, but my naive attempt to implement gapless playback (which I don't think it's really possible) would be:
- when first opening the video file, after decoding the header, save some pointer pointing at the offset at the first video block in the file
- after finishing with the last video block, instead of closing the devices in use and reopening them cleanly, instead seek back to the offset of the first block and continue reading from there (and feeding data into the video decoder, etc).

In theory it's plausible it would work. In practice I expect issues from the audio-video synchronization timestamps which suddenly go backward and will probably confuse the decoder. Not sure if there's a way to adjust them, before feeding the data into the decoder. It might be a temporary solution, because at some point they would overflow and cause issues again.

I'm sure @crashoverride has a better explanation.

Edit - I have a workaround, if a frozen frame is acceptable, instead of black. So, when the video is about to close, do a screenshot of the framebuffer (there are tools to do it). Display this to /dev/fb1 - which is the overlay for the hardware mouse cursor - after extending it to cover the whole screen. When playback loops, after the first block has been decoded, make /dev/fb1 transparent, so the video shows below.


trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

@rooted a black screen for 1 or 2 sec.

trivettegiacomo
Posts: 21
Joined: Wed Oct 25, 2023 4:58 pm
languages_spoken: english, italian
ODROIDs: c4
Has thanked: 0
Been thanked: 0
Contact:

Re: mp4 video playback

Post by trivettegiacomo »

rooted wrote:
Thu Nov 02, 2023 7:15 am
A black screen for how long?
for 1 or 2 sec

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 1 guest