Play YUV-files from a Python script

This forum is about all development around libVLC.
Oussama_Chiha
New Cone
New Cone
Posts: 2
Joined: 07 Aug 2019 10:56

Play YUV-files from a Python script

Postby Oussama_Chiha » 16 Aug 2019 15:39

Hi everyone,
I'am trying to write a python script that plays YUV-files by using the vlc.py. My first script looks like this :

Code: Select all

import vlc instance = vlc.Instance() media = None mediaplayer = vlc.MediaPlayer() # Put the media in the media player mediaplayer.set_rate(24) mediaplayer.video_set_format('I420',1920,1080,2) media = instance.media_new('D:/hdr/Kimono_1920x1080_24.yuv') mediaplayer.set_media(media) mediaplayer.play()

but i get the following error messages :

Code: Select all

rawvid demux error: invalid or no framerate specified. [IMGUTILS @ 0000005db409efc0] Picture size 0x0 is invalid [0000024c620b92c0] avcodec demux error: Could not open D:\hdr\Kimono_1920x1080_24.yuv: Invalid argument
Any tips would be very helpful.
Thank you in advance.

best,
Oussama

fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

Re: Play YUV-files from a Python script

Postby fossette » 19 Aug 2019 20:51

As far as I understand, YUV is just a pixel format.

Code: Select all

https://wiki.videolan.org/YUV/
If you don't have a specific codec for your file format, VLC will never know what to do with it. And we see this from the demux error above. I would suggest that you convert your file to a known container like mp4, mkv, avi, etc...

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: Play YUV-files from a Python script

Postby chubinou » 26 Aug 2019 11:27

Hi,

you can try something like this:

Code: Select all

media = instance.media_new("file/rawvid://D:/hdr/Kimono_1920x1080_24.yuv", ":rawvid-fps=24", ":rawvid-chroma=I420", ":rawvid-width=1920", ":rawvid-height=1080")
mediaplayer.video_set_format doesn't specify the input format but the decoding format, to be able to use video frames within your program.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests