Command line video player

Post Reply
User avatar
rooted
Posts: 7991
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 724 times
Been thanked: 243 times
Contact:

Re: Command line video player

Post by rooted »

aer wrote: I looked at some instructions on the Boom Bonnet, but for some reason my ubuntu doesn't have aplay, so can't test I2S availability.
aplay is in alsa-utils package

Code: Select all

sudo apt install alsa-utils

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

pro777 wrote:Is there a problem with support for the VP9 codec?
Neither the S905 nor the S805 support VP9 in hardware.
pro777 wrote:It would be good to add the support of MSMPEG4v1 and MSMPEG4v2 codecs
pro777 wrote: as well the audio codec PCM_s16le.
I currently have no plans to support those formats since they are rare.
pro777 wrote:The release version when you try to play ends with an error:
pro777 wrote:In addition, the X11 version of the player displays a black screen instead of video, but there is sound.
Only the C1 and C2 hardware are supported. I do not have any S912 hardware to test on and have no plans to support it. The issues reported do not occur on supported hardware using a supported distro (ubuntu 16.04/18.04).
pro777 wrote:It would be convenient to add the display of the current position of playing in the format HH:MM:SS in pause mode.
c2play is not intended to be a full featured media player. For advanced features, Kodi or MPV is recommended.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

aer wrote:How can I enable I2S for use with c2play?
c2play uses ALSA for sound output. ALSA will need to be configured to use I2S.

aer
Posts: 4
Joined: Thu Aug 23, 2018 11:17 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by aer »

Ok, thanks, that solved it.

aer
Posts: 4
Joined: Thu Aug 23, 2018 11:17 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by aer »

@crashoverride is it possible to change the rendering of the subtitles: i.e. font, outline color, etc.? I see in the code libass is given a 'sans serif'. I could of course drop a sans serif named font in a directory to change that? But doesn't seem an elegant solution. Can you point me where in the code the rendering options are set? Thanks for c2play btw, almost solves my problems creating a kiosk-like setup.

Update: I have been looking into the libass code more. It seems I have to call void ass_set_style_overrides(ASS_Library *priv, char **list); and override the styles I want to change. I am no c++ programmer, so how can I call that function with the right syntax for list?

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

aer wrote:Can you point me where in the code the rendering options are set?
The options are set here:
https://github.com/OtherCrashOverride/c ... #L526-L534
aer wrote:It seems I have to call void ass_set_style_overrides(ASS_Library *priv, char **list); and override the styles I want to change. I am no c++ programmer, so how can I call that function with the right syntax for list?
"char **list" is most likely an "array of char*". This would imply it expects an array of pointers to null terminated strings. Since there is no count parameter, it probably expects a null pointer to terminate the array. As an example:

Code: Select all

const char* list[] = { "item1", "item2", "item3", NULL };
I have not verified any of the above. It is just an educated guess. The libass documentation (if any?) will need to be consulted. Also note that the example is "const char*" and not "char*". The former can not be altered while the later implied either an error in API definition (requiring a cast) or the library will modify the string requiring dynamic allocation (malloc).

aer
Posts: 4
Joined: Thu Aug 23, 2018 11:17 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by aer »

crashoverride wrote:
aer wrote:Can you point me where in the code the rendering options are set?
The options are set here:
https://github.com/OtherCrashOverride/c ... #L526-L534
aer wrote:It seems I have to call void ass_set_style_overrides(ASS_Library *priv, char **list); and override the styles I want to change. I am no c++ programmer, so how can I call that function with the right syntax for list?
"char **list" is most likely an "array of char*". This would imply it expects an array of pointers to null terminated strings. Since there is no count parameter, it probably expects a null pointer to terminate the array. As an example:

Code: Select all

const char* list[] = { "item1", "item2", "item3", NULL };
I have not verified any of the above. It is just an educated guess. The libass documentation (if any?) will need to be consulted. Also note that the example is "const char*" and not "char*". The former can not be altered while the later implied either an error in API definition (requiring a cast) or the library will modify the string requiring dynamic allocation (malloc).
The compiler doesn't like that const char* list[], it complains with:
error: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]

However I already got it working with a warning:

Code: Select all

char *list[] = {"Outline=0", 0};
warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
The font outline is now disabled, but still cannot change the font.
I also tried changing sans-serif to monospace on line 533 or pointing to a font directory but that won't yield any results.

A debugging issue cropped up with subtitles. When I have a few subtitles on a test video, when I stop c2play, it seems it just waits till the scheduled subtitles are timeout?

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

aer wrote:The compiler doesn't like that const char* list[], it complains with:
error: invalid conversion from ‘const char**’ to ‘char**’ [-fpermissive]

However I already got it working with a warning:

Code: Select all
char *list[] = {"Outline=0", 0};
warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
That is exactly why i stated:
crashoverride wrote:Also note that the example is "const char*" and not "char*". The former can not be altered while the later implied either an error in API definition (requiring a cast) or the library will modify the string requiring dynamic allocation (malloc).
aer wrote:it seems it just waits till the scheduled subtitles are timeout?
I don't think there is any logic to flush subtitle data when prematurely stopped.

pcarrillom
Posts: 4
Joined: Wed Sep 12, 2018 4:17 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by pcarrillom »

Hello,

I have a working C2play-x11 in an Odroid C2 with Ubuntu 18.04. So far so good. Thanks for the hard work!.
I`m receiving some udp video streams that have one video and multiple audio programs on it. I can play the video and select which audio program to play with the command line, however, I need to play Left channel output with left channel of the first audio program and the right channel output with the right channel of the second audio program. Is this something that can be done directly with c2play?

Thanks for the suggestions.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

pcarrillom wrote:I need to play Left channel output with left channel of the first audio program and the right channel output with the right channel of the second audio program. Is this something that can be done directly with c2play?
No. It would require instantiating another audio decoder and coding an audio mixer component.

As an alternative, there is probably a ffmpeg command that could be used to perform the decoding and mixing. The output of ffmpeg could then be sent to c2play for playback.

pcarrillom
Posts: 4
Joined: Wed Sep 12, 2018 4:17 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by pcarrillom »

crashoverride wrote:
pcarrillom wrote:I need to play Left channel output with left channel of the first audio program and the right channel output with the right channel of the second audio program. Is this something that can be done directly with c2play?
No. It would require instantiating another audio decoder and coding an audio mixer component.

As an alternative, there is probably a ffmpeg command that could be used to perform the decoding and mixing. The output of ffmpeg could then be sent to c2play for playback.
Thanks. Yes, I could use ffmpeg, however it does not support hardware decoding on C2, as far as I know. Or do you know a way of compiling ffmpeg with hardware decoding support on C2?

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

You don't need it to do hardware decoding. Only muxing the h264 video stream with the combined audio streams. It would just do software audio encoding, which is ok for real-time on the c2. The output would be a stream with 1 video stream and 1 audio stream that c2play can handle. It will probably communicate via a pipe

Domi
Posts: 8
Joined: Thu Sep 20, 2018 8:44 pm
languages_spoken: english, german
ODROIDs: C2, XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by Domi »

Great work!

Works fine so far on Ubuntu 16.04, compiled from bionic branch.

This is probably more of an libav question but I thought I would ask here first: Any ideas how I can get a faster startup speed when receiving a UDP multicast stream?

Code: Select all

c2play-x11 udp://239.1.1.1:1234
Gives horrible startup speeds of 6-12 seconds (time from application start to first image) but it can be tweaked with analyzeduration:

Code: Select all

c2play-x11 --avdict 'analyzeduration:1000000' udp://239.1.1.1:1234
This significantly shortens the startup time to just 3-4 seconds, which is quite decent already but I'm wondering if there are any more tweaks I should be aware of? I also tried playing with probesize and buffer_size but I couldn't find any improvements by using them.

pcarrillom
Posts: 4
Joined: Wed Sep 12, 2018 4:17 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by pcarrillom »

Hello

I'm using c2play to playout a live stream from ffmpeg h264_qsv encoder with UDP output.
Using the following command in c2play, the video plays but with glitches and freezes frequently:

c2play -l udp://@:1500

If I use the next one, video plays perfect for some time. 10 minutes sometimes, 20 minutes others, but after that, it begins to stutter. Log shows PTS adjustment continuously after that and then the only way to get normal video is to stop/start c2play:

c2play -l "udp://@:1500?pkt_size=1316&buffer_size=26214400"

Thanks for your comments.
Last edited by pcarrillom on Thu Nov 08, 2018 9:28 pm, edited 1 time in total.

elatllat
Posts: 1793
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2, C4, N2+
Has thanked: 50 times
Been thanked: 115 times
Contact:

Re: Command line video player

Post by elatllat »

:lol: " after that, it begins to [play erotic video](slutter)", I have no idea why that amuses me so.
We know what you mean though ;)

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

Welcome to the 3rd grade club. I'll be your guide :D

pcarrillom
Posts: 4
Joined: Wed Sep 12, 2018 4:17 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by pcarrillom »

Ok guys. I corrected my post.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

c2play does not officially support any streaming source:
https://github.com/OtherCrashOverride/c ... ME#L37-L38
Supported containers:
MKV, AVI, MP4 have been tested.
None of these containers are suitable for UDP use. UDP streams are subject to data loss and out of order arrival.

brokentilez
Posts: 1
Joined: Tue Nov 13, 2018 12:24 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by brokentilez »

UDP is prone to out of orders and packet loss, but it's been the defacto standard in broadcast for a long time. RTP came about and RTP with SMPTE 2022 FEC, but this CLI player would be awesome for a UDP/RTP/HLS little test streaming decoder. Is your c2play development dead or do you wish to continue doing any work? I'd love to help continue developing features on this player, but I'm not a c programmer (i do more php). I got training to do to help contribute to this cool project. :)

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

I think @crashoverride's goal has been to reverse engineer the amlogic encoder/decoder api and build a sample player on top of it. I doubt he meant to create and support a feature-rich player. But he always encouraged others to fork and continue his work.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

c2play originated as a demonstration of using the hardware video codec. I further developed it as tool for my personal use that I then shared with the community. It is capable of network streaming (I stream from SMB and HTTP [DLNA] servers), but the caveat is that only reliable transports and containers are supported. Unreliable transports such as UDP or containers such as MPEG-TS may contain erroneous data that causes the hardware codec to malfunction.

c2play will attempt to use any transport supported by libav (ffmpeg); however, I can not guarantee correct operation. It it up to the end user/community to diagnose any issues encountered.

c2play is maintained. This means that I patch it as necessary to support official OS updates. I do not have plans for additional features since it already does exactly what I need it to do.

alabama
Posts: 17
Joined: Wed Mar 22, 2017 12:27 am
languages_spoken: english
ODROIDs: 2x Odroid C1+
2x Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by alabama »

And what about interlaced sources such as 1080i50 ?
RPi has hsv_update_fields capabilities (https://github.com/raspberrypi/firmware/issues/292).
How can this be achieved on Odroid C2 to avoid bad reordering of pure TFF or BFF and flickering ?

Thanks

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

alabama wrote:And what about interlaced sources such as 1080i50 ?
This is handled transparently by the Amlogic Video Engine (AVE). I have tested it operates correctly using MPEG2 ATSC source media and with Kodi test streams.

alabama
Posts: 17
Joined: Wed Mar 22, 2017 12:27 am
languages_spoken: english
ODROIDs: 2x Odroid C1+
2x Odroid C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by alabama »

I regret to contradict you, but at this moment I'm playing an HEVC 1080i50 source, and fields are displayed reversed, so video is flickering in my display, using setenv m "1080i50hz" at boot.ini.
If I stop c2play and restart it, only in few occasions, fields are displayed in the correct order (TFF). So I guess is the same behavior than RPi when hvs_update_fields = 0. Random field order display.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

I tested interlaced content on a progressive display. I have not tested interlaced content on an interlaced display since all modern displays are progressive.

huantxo
Posts: 29
Joined: Thu Feb 22, 2018 1:09 am
languages_spoken: English, Spanish
ODROIDs: HC1, XU4, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by huantxo »

Hello. I'm having trouble to compile the program. This is the error I get:

Code: Select all

../../src/Media/MediaSourceElement.cpp:163:11: error: 'CODEC_ID_MPEG2VIDEO' was not declared in this scope
      case CODEC_ID_MPEG2VIDEO:
           ^~~~~~~~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:163:11: note: suggested alternative: 'AV_CODEC_ID_MPEG2VIDEO'
      case CODEC_ID_MPEG2VIDEO:
           ^~~~~~~~~~~~~~~~~~~
           AV_CODEC_ID_MPEG2VIDEO
../../src/Media/MediaSourceElement.cpp:175:11: error: 'CODEC_ID_MPEG4' was not declared in this scope
      case CODEC_ID_MPEG4:
           ^~~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:175:11: note: suggested alternative: 'AV_CODEC_ID_MPEG4'
      case CODEC_ID_MPEG4:
           ^~~~~~~~~~~~~~
           AV_CODEC_ID_MPEG4
../../src/Media/MediaSourceElement.cpp:181:11: error: 'CODEC_ID_H264' was not declared in this scope
      case CODEC_ID_H264:
           ^~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:181:11: note: suggested alternative: 'AV_CODEC_ID_H264'
      case CODEC_ID_H264:
           ^~~~~~~~~~~~~
           AV_CODEC_ID_H264
../../src/Media/MediaSourceElement.cpp:194:11: error: 'CODEC_ID_VC1' was not declared in this scope
      case CODEC_ID_VC1:
           ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:194:11: note: suggested alternative: 'AV_CODEC_ID_VC1'
      case CODEC_ID_VC1:
           ^~~~~~~~~~~~
           AV_CODEC_ID_VC1
../../src/Media/MediaSourceElement.cpp:245:11: error: 'CODEC_ID_MP2' was not declared in this scope
      case CODEC_ID_MP2:
           ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:245:11: note: suggested alternative: 'AV_CODEC_ID_MP2'
      case CODEC_ID_MP2:
           ^~~~~~~~~~~~
           AV_CODEC_ID_MP2
../../src/Media/MediaSourceElement.cpp:251:11: error: 'CODEC_ID_MP3' was not declared in this scope
      case CODEC_ID_MP3:
           ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:251:11: note: suggested alternative: 'AV_CODEC_ID_MP3'
      case CODEC_ID_MP3:
           ^~~~~~~~~~~~
           AV_CODEC_ID_MP3
../../src/Media/MediaSourceElement.cpp:257:11: error: 'CODEC_ID_AAC' was not declared in this scope
      case CODEC_ID_AAC:
           ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:257:11: note: suggested alternative: 'AV_CODEC_ID_AAC'
      case CODEC_ID_AAC:
           ^~~~~~~~~~~~
           AV_CODEC_ID_AAC
../../src/Media/MediaSourceElement.cpp:263:11: error: 'CODEC_ID_AC3' was not declared in this scope
      case CODEC_ID_AC3:
           ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:263:11: note: suggested alternative: 'AV_CODEC_ID_AC3'
      case CODEC_ID_AC3:
           ^~~~~~~~~~~~
           AV_CODEC_ID_AC3
../../src/Media/MediaSourceElement.cpp:269:11: error: 'CODEC_ID_DTS' was not declared in this scope
      case CODEC_ID_DTS:
           ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:269:11: note: suggested alternative: 'AV_CODEC_ID_DTS'
      case CODEC_ID_DTS:
           ^~~~~~~~~~~~
           AV_CODEC_ID_DTS
../../src/Media/MediaSourceElement.cpp:346:12: error: 'CODEC_ID_HDMV_PGS_SUBTITLE' was not declared in this scope
      case  CODEC_ID_HDMV_PGS_SUBTITLE:
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:346:12: note: suggested alternative: 'AV_CODEC_ID_HDMV_PGS_SUBTITLE'
      case  CODEC_ID_HDMV_PGS_SUBTITLE:
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
            AV_CODEC_ID_HDMV_PGS_SUBTITLE
../../src/Media/MediaSourceElement.cpp:351:12: error: 'CODEC_ID_DVB_SUBTITLE' was not declared in this scope
      case  CODEC_ID_DVB_SUBTITLE:
            ^~~~~~~~~~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:351:12: note: suggested alternative: 'AV_CODEC_ID_DVB_SUBTITLE'
      case  CODEC_ID_DVB_SUBTITLE:
            ^~~~~~~~~~~~~~~~~~~~~
            AV_CODEC_ID_DVB_SUBTITLE
../../src/Media/MediaSourceElement.cpp:356:12: error: 'CODEC_ID_TEXT' was not declared in this scope
      case  CODEC_ID_TEXT:
            ^~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:356:12: note: suggested alternative: 'AV_CODEC_ID_TEXT'
      case  CODEC_ID_TEXT:
            ^~~~~~~~~~~~~
            AV_CODEC_ID_TEXT
../../src/Media/MediaSourceElement.cpp:361:12: error: 'CODEC_ID_XSUB' was not declared in this scope
      case  CODEC_ID_XSUB:
            ^~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:361:12: note: suggested alternative: 'AV_CODEC_ID_XSUB'
      case  CODEC_ID_XSUB:
            ^~~~~~~~~~~~~
            AV_CODEC_ID_XSUB
../../src/Media/MediaSourceElement.cpp:365:12: error: 'CODEC_ID_SSA' was not declared in this scope
      case  CODEC_ID_SSA:
            ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:365:12: note: suggested alternative: 'AV_CODEC_ID_SSA'
      case  CODEC_ID_SSA:
            ^~~~~~~~~~~~
            AV_CODEC_ID_SSA
../../src/Media/MediaSourceElement.cpp:369:12: error: 'CODEC_ID_MOV_TEXT' was not declared in this scope
      case  CODEC_ID_MOV_TEXT:
            ^~~~~~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:369:12: note: suggested alternative: 'AV_CODEC_ID_MOV_TEXT'
      case  CODEC_ID_MOV_TEXT:
            ^~~~~~~~~~~~~~~~~
            AV_CODEC_ID_MOV_TEXT
../../src/Media/MediaSourceElement.cpp:374:12: error: 'CODEC_ID_DVB_TELETEXT' was not declared in this scope
      case  CODEC_ID_DVB_TELETEXT:
            ^~~~~~~~~~~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:374:12: note: suggested alternative: 'AV_CODEC_ID_DVB_TELETEXT'
      case  CODEC_ID_DVB_TELETEXT:
            ^~~~~~~~~~~~~~~~~~~~~
            AV_CODEC_ID_DVB_TELETEXT
../../src/Media/MediaSourceElement.cpp:379:12: error: 'CODEC_ID_SRT' was not declared in this scope
      case  CODEC_ID_SRT:
            ^~~~~~~~~~~~
../../src/Media/MediaSourceElement.cpp:379:12: note: suggested alternative: 'AV_CODEC_ID_SRT'
      case  CODEC_ID_SRT:
            ^~~~~~~~~~~~
            AV_CODEC_ID_SRT
I have installed all the ffmpeg dev files.

Anyone who can help?
Last edited by huantxo on Wed Feb 06, 2019 9:52 pm, edited 2 times in total.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

For Ubuntu 18.04, use the "bionic" branch:
https://github.com/OtherCrashOverride/c ... ree/bionic

huantxo
Posts: 29
Joined: Thu Feb 22, 2018 1:09 am
languages_spoken: English, Spanish
ODROIDs: HC1, XU4, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by huantxo »

crashoverride wrote:
Wed Feb 06, 2019 2:37 pm
For Ubuntu 18.04, use the "bionic" branch:
https://github.com/OtherCrashOverride/c ... ree/bionic
Thanks, that did the trick!

User avatar
szabe
Posts: 4
Joined: Wed Jan 22, 2020 4:59 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 7 times
Contact:

Odroid C2 for Digital Video Signage

Post by szabe »

Hi all, I would like to share my experiences about c2play for the purpose of getting help.
My goal to be achieved is a fast, reliable video signage controlled by GPIO inputs. No web access no fancy stuff just pure video playing!

Environment: Odroid C2 with Ubuntu 16.04 minimal image

Prepare the C2 env:

Code: Select all

sudo apt install git libasound2-dev libavformat-dev libass-dev libx11-dev libegl1-mesa-dev libgles2-mesa-dev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
git clone https://github.com/OtherCrashOverride/c2play.git
cd c2play/
make c2play-x11 -j4
sudo apt install xorg
Plus some other todoes not detailed here:
- redirects boot logs from the terminal screen to the serial port (silent boot)
- autologin
- sudo needs no password to grant root rights
- delete all unnecessar cron jobs which possibly could slowing down the Linux
- disable all power saving stuff to avoid conflicts

There is a script: start.sh is running after boot and autologin which contains the following command:

Code: Select all

sudo startx -- -nocursor > /dev/ttyS0 2>&1
It starts a X session and redirects the normal and the error output to the serial port for logging and debugging purpose.
This caused that in the started X environment there is nothing just a black blank screen in normal and error output case too.
The .xinitrc file starting automatically by the startx so it contains the following small script:

Code: Select all

sudo /home/odroid/c2play/c2play-x11 > /dev/ttyS0 2>&1
In the c2play codebase from the main.cpp I cleared all input related code even the command line argument parsing just keep the video playing related code for testing purpose. I hardcoded the video URLs and the test logic.

After preparing env. and proper build of c2play I tried the following:


1. TRY
playing more than one video file inside the C2play
- I created a new method in the MediaPlayer class called ChangeSource

Code: Select all

	void MediaPlayer::ChangeSource(std::string url, int videoStream, int audioStream, int subtitleStream) {
		// Destruct the current source
		...
		...
		// Construct the new source with the new URL
		...
		...
	}
- It is called from the main runloop triggered by a GPIO event just like:

Code: Select all

		mediaPlayer->ChangeSource(newurl, 0, 0, -1);
		mediaPlayer->Seek(0);
		mediaPlayer->SetState(MediaState::Play);
In the stress test two video played alternately a.mkv and b.mkv (normal compression rate full hd 10 minutes videos)
It worked with two major issue:
1. the memory is leaked some reason even I tried everything to correctly dispose all smart pointer and buffer.. I failed the memory was leaked
2. switching between videos was slow and there was a 1-2 sec long blank screen between them


2. TRY
To avoid memory leakage and blank screen on switch videos I merged the two video into one and just started playing and then seek(position for video1) then seek(0)
In the stress test in the middle of the video I started to seek to the second one and at the end seek to 0 to start the whole playing again

It worked with one major and two minor issue:
1. MAJOR: In the 48 hours stress test the seek method sporadically stucked and there was only a blank screen forever. I debugged and I realized that this code is stucking sometimes

Code: Select all

		void Element::WaitForExecutionState(ExecutionStateEnum state)
			{
				pthread_mutex_lock(&executionWaitMutex);

				while (executionState != state)
				{
					pthread_cond_wait(&executionWaitCondition, &executionWaitMutex);
				}

				pthread_mutex_unlock(&executionWaitMutex);

			}
In the Element class some reason this while loop becomes an endless loop on Seek()

2. MINOR: seeking is faster than restarting but not fast enough and there is a blank screen during seeking
3. MINOR: seeking is not precise. +- 5 frames maybe mistaken. My fault that I haven't tried seeking with keyframes, maybe it works precisely with that


3. TRY
Switching videos is leaking, loop playing with seek(0) is stucking, so I tried to stop the whole c2play app and start again as a workaround loop playing solution

The .xinitrc file contains the following small script in this case:

Code: Select all

	while :
	do
	sudo /home/odroid/c2play/c2play-x11 > /dev/ttyS0 2>&1
	done
Experience:
stopping and starting the video again is average 1.5 sec but sometimes it is longer I don't know why.
There is no memory leaking but the major issue is after 24+ hours loop playing I can see only blank screen. It probably caused by the first initial seek in the main.cpp

Code: Select all

		mediaPlayer->Seek(optionStartPosition);
		mediaPlayer->SetState(MediaState::Play);
Conclusion
is that It could work as a Digital Signage with some limitation but I stucked in the endless loop issue on seeking. (even the 3rd loop playing solution could be stuck because of the first seek in the main.cpp)
Can anybody help me in these issues above especially the seek() issue?
Thnx in advance..

Br: szabe
These users thanked the author szabe for the post:
rooted (Fri Jan 24, 2020 3:47 pm)

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

Do you still get audio when the screen is blank? It could be X11 screen blanking which can be turned off with xset dpms off or something similar.

User avatar
szabe
Posts: 4
Joined: Wed Jan 22, 2020 4:59 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 7 times
Contact:

Re: Command line video player

Post by szabe »

Hi mad_ady,
No there was no audio.
As I described in my previous long reply:
- disable all power saving stuff to avoid conflicts
I debuged and the Element::WaitForExecutionState method went to deadlock some unknown reason.

I forget to describe how to test this deadlock situation:
- just start to play any normal video file
- in the main.cpp in the process runloop on every 3 seconds do a Seek(0) to restart the video.
- it works but after a few minutes or hours it will be deadlocked with a blank screen.
- there is no exception or exit, there is nothing in the kernel log. Just deadlock

Br: szabe

User avatar
szabe
Posts: 4
Joined: Wed Jan 22, 2020 4:59 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 7 times
Contact:

Re: Command line video player

Post by szabe »

Hi all,

so finally I have found the possible root cause of the deadlock on Seek() in the Element class.
I fixed it then I started to test..
After running a 33+ hours stress test with more than 40000 Seek(0) operation the deadlock did not apply anymore. It was running smoothly, stable. Anyway I realized that the seek process has become consistently equally fast after the bugfix.

So I created a fixed version in my forked repo located here:
https://github.com/belaszalontai/c2play/tree/xenial
this is for Ubuntu 16.04 Xenial

I have also merged the fixes into the bionic branch for Ubuntu 18.04 here (not tested just merged):
https://github.com/belaszalontai/c2play/tree/bionic

I will be back soon with a GPIO input solution I have already implemented but not yet well tested..

Br: szabe
These users thanked the author szabe for the post (total 3):
rooted (Fri Jan 24, 2020 3:42 pm) • mad_ady (Fri Jan 24, 2020 5:23 pm) • odroid (Tue Jan 28, 2020 1:22 pm)

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

c2play is heavily dependent on the kernel. Amlogic's media stack resides entirely in kernel space. This makes it very difficult to isolate what is a c2play issue and what is a kernel codec issue. When something unexpected happens, c2play throws an exception instead of further progressing in an undefined state.

For digital signage (24/7 operation), it is recommended to use another program (such as ffmpeg) to compose a MPEG-TS stream in real-time from the content. This is then 'streamed' (using loopback network interface) to c2play avoiding the need to loop, seek, etc.

[edit]
Example:
Playlist -> FFMpeg (or other) -> MPEG-TS -> udp://127.0.0.1/port -> c2play

In the above example, all that FFMpeg is doing is re-muxing video from a container format such as .mov, .mkv, etc into a a different container format (MPEG-TS). It is not transcoding (changing codec format) the media.
These users thanked the author crashoverride for the post:
rooted (Wed Jan 29, 2020 7:55 am)

User avatar
szabe
Posts: 4
Joined: Wed Jan 22, 2020 4:59 am
languages_spoken: english
ODROIDs: Odroid C2
Has thanked: 0
Been thanked: 7 times
Contact:

GPIO driven digital video signage solution based on c2play

Post by szabe »

Hi all,

The stable version of a GPIO driven digital video signage solution based on c2play is ready and released for Ubuntu xenial here:

https://github.com/belaszalontai/c2play ... al-signage

Please read the how_to_use.txt for more detailed infos..

It was tested for days. No crash, no deadlock, no memory leaks.

And finally thanx to crashoverride for the c2play.

br: szabe
These users thanked the author szabe for the post (total 3):
rooted (Wed Jan 29, 2020 7:55 am) • odroid (Wed Jan 29, 2020 9:38 am) • mad_ady (Wed Jan 29, 2020 1:47 pm)

cjheath
Posts: 10
Joined: Sat Feb 22, 2020 4:03 pm
languages_spoken: english
ODROIDs: None yet. Want N2 for Software Defined Radio app
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by cjheath »

crashoverride wrote:
Wed Feb 06, 2019 2:37 pm
For Ubuntu 18.04, use the "bionic" branch:
https://github.com/OtherCrashOverride/c ... ree/bionic
Please add this instruction to the README so others don't stumble (like me!) over the same problem and have to search here to find the answer

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

BonnieWhitcomb wrote:I'm looking for a free software video player than doesn't require installation; that is, it is an .exe that will run without being registered in Windows (installed). It needs to accept a command line argument such as: videoplayer.exe Video_TS/Video_TS.VOB Does something like this exist?
Widely offtopic. This forum seldomly deals with windows

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

Re: Command line video player

Post by rooted »

BonnieWhitcomb wrote:I'm looking for a free software video player than doesn't require installation; that is, it is an .exe that will run without being registered in Windows (installed). It needs to accept a command line argument such as: videoplayer.exe Video_TS/Video_TS.VOB Does something like this exist?
https://portableapps.com/apps/music_video/vlc_portable

penguinist
Posts: 33
Joined: Mon Mar 14, 2016 12:05 pm
languages_spoken: english, german, spanish
ODROIDs: odroid-c2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by penguinist »

Has c2play been ported to run on the Odroid-C4 in the Wayland 20.04 environment? (See: https://www.youtube.com/watch?v=4MfHMKcHaUc)

There is a reference on the C4 announcement stating: "We have c2play and kplayer examples which can play 4K/UHD H.265 60fps videos smoothly on the framebuffer of ODROID-C4’s HDMI output. ". That sounds optimistic, but I don't see a "c2play" in the C4/20.04 apt repository.

Does anyone have information on the c2play/c4 status or a link to the sources?

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

https://github.com/OtherCrashOverride/c2play
Check for the most recent branch.

penguinist
Posts: 33
Joined: Mon Mar 14, 2016 12:05 pm
languages_spoken: english, german, spanish
ODROIDs: odroid-c2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by penguinist »

Outstanding!

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

c2play outputs to the hardware video plane (VID0) and FBDEV (/dev/fb0) using the Amlogic provided kernel media path. It does not support KMS/DRM (/dev/dri/card0) as required by a Wayland environment or the use of a V4L2 media path used by mainstream kernels. (FBDEV+AMVIDEO vs KMS/DRM+V4L2)

The mainline kernel video hardware support is rudimentary. I should also note that Wayland is not well suited to video display on low cost ARM SBCs. While 1080p should not have issues, 4K@60 HDR requires a significant amount of memory bandwidth. ARM introduced framebuffer compression (AFBC) to mitigate this. However, Wayland will disrupt the zero-copy data flow due to its role.

penguinist
Posts: 33
Joined: Mon Mar 14, 2016 12:05 pm
languages_spoken: english, german, spanish
ODROIDs: odroid-c2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by penguinist »

Interesting point on the need for framebuffer compression to offset memory bandwidth limitations. Well we don't want to compromise and settle for 1080p, that would be so "last decade". Happiness will be 4K@60 HDR running on the C4.

I've often wondered how you accomplished c2play-x11. I assume that you somehow "took down x11" in order to drive the video plane directly and then on termination somehow restored x11 back to operation. A few words on the technique you employed there would be enlightening. Maybe there is something similar that could be done in a c4/wayland environment to take the Wayland stack out of the picture temporarily.

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

penguinist wrote:
Thu May 14, 2020 5:10 am
A few words on the technique you employed there would be enlightening
X11 renders to FBDEV. The frame buffer is set to 32bit in boot.ini. This creates a special case where alpha is actually used (RGBA : A=alpha). The alpha value is the transparency level. C2play-X11 creates a transparent window in X11 allowing the hardware video plane (VID0) to show through.

Logically, there is VID0, VID1, FB0, FB1 planes. Each plane overlays the previous. When a display component of a plane is transparent (alpha < 255), the previously plane shows through.

penguinist
Posts: 33
Joined: Mon Mar 14, 2016 12:05 pm
languages_spoken: english, german, spanish
ODROIDs: odroid-c2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by penguinist »

Elegant.

mad_ady
Posts: 8474
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 578 times
Been thanked: 465 times
Contact:

Re: Command line video player

Post by mad_ady »

So, in theory couldn't you do the same trick for wayland, by building a specific transparent wayland window?

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

mad_ady wrote:
Thu May 14, 2020 12:29 pm
couldn't you do the same trick for wayland
In the FBDEV+X11 world, the display controller configuration is "fixed". The planes will always exist and always have a specific color format and order.

Wayland (actually Weston) is different because it takes control of the display controller. It may or may not choose to use an alpha enabled frame buffer. It may or may not re-order planes. Therefore, the same assumptions can not be made that are done for X11. A transparent Wayland window will likely be solid black when its composited.
These users thanked the author crashoverride for the post:
mad_ady (Thu May 14, 2020 3:02 pm)

penguinist
Posts: 33
Joined: Mon Mar 14, 2016 12:05 pm
languages_spoken: english, german, spanish
ODROIDs: odroid-c2
Has thanked: 0
Been thanked: 0
Contact:

Re: Command line video player

Post by penguinist »

Sounds like Wayland will also be a problem for gaming software on small systems, but then again most serious gamers are set up with high end systems with plenty of memory bandwidth.

So on small machines like the C4 we are left with these choices:

1. Encourage Weston to "play nice" with the display controller.
2. Use X11 as the best choice for high performance video applications.
3. Use native framebuffer (e.g. CoreELEC, etc.)

shanti
Posts: 302
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 75 times
Been thanked: 116 times
Contact:

Re: Command line video player

Post by shanti »

crashoverride wrote:
Thu May 14, 2020 2:53 pm
Been trying for a while to compile (cross compile) c2play to use on the n2 and I finally managed to do it, well I think I did! now I am just wondering if this player would work on the N2 (fbdev, no x11), I can compile the bionic branch, and it seems to want to run but I get this error:

Code: Select all

added device: /dev/input/event2
added device: /dev/input/js0
added device: /dev/input/event1
added device: /dev/input/event0
added device: /dev/input/mice
Device: /dev/input/event2
	bustype=25, vendor=0, product=0, version=0
	name=meson-ir
InputDevice entering running state.
Device: /dev/input/js0
EVIOCGBIT failed.
Device: /dev/input/event1
	bustype=3, vendor=3853, product=193, version=273
	name=HORI CO.,LTD. HORIPAD S
InputDevice entering running state.
Device: /dev/input/event0
	bustype=16, vendor=7054, product=3308, version=1
	name=cec_input
InputDevice entering running state.
Device: /dev/input/mice
EVIOCGBIT failed.
Using input device: meson-ir
Using input device: HORI CO.,LTD. HORIPAD S
Using input device: cec_input
EGL: major=1, minor=4
EGL: Vendor=ARM
EGL: Version=1.4 Bifrost-"git"
EGL: ClientAPIs=OpenGL_ES
EGL: Extensions=EGL_KHR_partial_update EGL_EXT_image_dma_buf_import EGL_KHR_config_attribs EGL_KHR_image EGL_KHR_image_base EGL_KHR_fence_sync EGL_KHR_wait_sync EGL_KHR_gl_colorspace EGL_KHR_get_all_proc_addresses EGL_IMG_context_priority EGL_KHR_no_config_context EGL_ARM_pixmap_multisample_discard EGL_ARM_implicit_external_sync EGL_KHR_gl_texture_2D_image EGL_KHR_gl_renderbuffer_image EGL_KHR_create_context EGL_KHR_surfaceless_context EGL_KHR_gl_texture_cubemap_image EGL_EXT_create_context_robustness
EGL: ClientExtensions=EGL_EXT_client_extensions EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses

eglGetError failed: 0x300d
terminate called after throwing an instance of 'Exception'
Aborted
is it possible to run on other devices other than c2?

crashoverride
Posts: 5109
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 368 times
Contact:

Re: Command line video player

Post by crashoverride »

shanti wrote:
Fri Jul 24, 2020 1:51 pm
is it possible to run on other devices other than c2?
I have not tested it on any other platform. I do have plans to bring official support for C4/N2(+) in the near future. Note that due to COVID-19, I can not offer any schedules or definitive time frames. Also be aware that a redesign is possible.
These users thanked the author crashoverride for the post (total 2):
elatllat (Fri Jul 24, 2020 8:31 pm) • joy (Thu Aug 13, 2020 4:50 pm)

shanti
Posts: 302
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 75 times
Been thanked: 116 times
Contact:

Re: Command line video player

Post by shanti »

crashoverride wrote:
Fri Jul 24, 2020 2:17 pm
shanti wrote:
Fri Jul 24, 2020 1:51 pm
is it possible to run on other devices other than c2?
I have not tested it on any other platform. I do have plans to bring official support for C4/N2(+) in the near future. Note that due to COVID-19, I can not offer any schedules or definitive time frames. Also be aware that a redesign is possible.
Thanks! no rush, just glad something is planned as a HW enabled FB video player is really needed! :)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 1 guest