Command line video player

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

Re: Command line video player

Unread post by rooted » Fri Aug 24, 2018 4:14 am

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Fri Aug 24, 2018 8:02 pm

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Fri Aug 24, 2018 8:05 pm

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

Unread post by aer » Sun Aug 26, 2018 6:36 pm

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

Unread post by aer » Wed Aug 29, 2018 8:00 am

@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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Thu Aug 30, 2018 4:55 pm

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

Unread post by aer » Thu Aug 30, 2018 6:14 pm

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Thu Aug 30, 2018 8:30 pm

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

Unread post by pcarrillom » Wed Sep 12, 2018 4:24 am

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Thu Sep 13, 2018 9:55 am

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

Unread post by pcarrillom » Thu Sep 20, 2018 1:52 am

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?

User avatar
mad_ady
Posts: 7558
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 391 times
Been thanked: 296 times
Contact:

Re: Command line video player

Unread post by mad_ady » Thu Sep 20, 2018 3:06 am

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

Unread post by Domi » Thu Sep 20, 2018 9:10 pm

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

Unread post by pcarrillom » Thu Nov 08, 2018 3:31 am

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: 1688
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1, N2
Has thanked: 31 times
Been thanked: 96 times
Contact:

Re: Command line video player

Unread post by elatllat » Thu Nov 08, 2018 6:02 am

: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 ;)

User avatar
mad_ady
Posts: 7558
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 391 times
Been thanked: 296 times
Contact:

Re: Command line video player

Unread post by mad_ady » Thu Nov 08, 2018 3:41 pm

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

Unread post by pcarrillom » Thu Nov 08, 2018 9:31 pm

Ok guys. I corrected my post.

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

Re: Command line video player

Unread post by crashoverride » Mon Nov 12, 2018 11:17 am

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

Unread post by brokentilez » Tue Nov 13, 2018 1:00 pm

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. :)

User avatar
mad_ady
Posts: 7558
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 391 times
Been thanked: 296 times
Contact:

Re: Command line video player

Unread post by mad_ady » Tue Nov 13, 2018 3:38 pm

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Thu Nov 15, 2018 9:07 am

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

Unread post by alabama » Wed Nov 21, 2018 2:17 am

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Wed Nov 21, 2018 10:30 am

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

Unread post by alabama » Fri Nov 23, 2018 1:48 am

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Fri Nov 23, 2018 11:11 pm

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

Unread post by huantxo » Wed Feb 06, 2019 2:17 pm

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Wed Feb 06, 2019 2:37 pm

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

Unread post by huantxo » Wed Feb 06, 2019 9:52 pm

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

Unread post by szabe » Wed Jan 22, 2020 5:21 am

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)

User avatar
mad_ady
Posts: 7558
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 391 times
Been thanked: 296 times
Contact:

Re: Command line video player

Unread post by mad_ady » Wed Jan 22, 2020 1:56 pm

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

Unread post by szabe » Wed Jan 22, 2020 5:33 pm

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

Unread post by szabe » Fri Jan 24, 2020 3:24 pm

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: 4836
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 246 times
Contact:

Re: Command line video player

Unread post by crashoverride » Tue Jan 28, 2020 11:46 pm

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

Unread post by szabe » Wed Jan 29, 2020 6:07 am

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)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 0 guests