Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plan to add support to xmltv output? #201

Open
cooliobr opened this issue Oct 6, 2022 · 39 comments
Open

Any plan to add support to xmltv output? #201

cooliobr opened this issue Oct 6, 2022 · 39 comments
Labels
enhancement New feature or request

Comments

@cooliobr
Copy link

cooliobr commented Oct 6, 2022

There are any plan to implement a xmltv for EPG?
may use https://www.themoviedb.org/ as source of content informations, it is opensource
https://api.themoviedb.org/3/movie/550?api_key=....

@jb-alvarado
Copy link
Member

What I have read says that ffmpeg doesn't support EPG, than there is no chance to get it into ffplayout.

@cooliobr
Copy link
Author

cooliobr commented Oct 6, 2022

Sorry, EPG is only a schedule, is not a ffmpeg issue.
example: i made this EPG http://200.194.238.236/rundown/index.php?ch=1 and it give to me a XML
http://200.194.238.236/rundown/epg.php then i can give it to cable operator.

@jb-alvarado
Copy link
Member

Ok, but I still think is a bit out of scope. To have this it need more information and normally you need a database or something to generate this. Extracting Title etc. from File name (which is the only information in the playlist) is not a good workaround (not even every character is allow, like question marks).

The problem go's a bit in this direction: #197

@cooliobr
Copy link
Author

@jb-alvarado , i have one idea about EPG.
is possible you generate playlist file with start-time key like.

{
  "channel": "CH1",
  "date": "2022-10-15",
  "program": [
    {
      "start-time": "05:59:59",
      "in": 0.0,
      "out": 290.9,
      "duration": 290.9,
      "source": "/var/lib/ffplayout/tv-media/HALLOWEEN COM LEO E LULLY _ DOCES OU TRAVESSURAS.mp4"
    },
    {
      "start-time": "06:05:59",
      "in": 0.0,
      "out": 248.17,
      "duration": 248.17,
      "category": "advertisement",
      "source": "/var/lib/ffplayout/tv-media/LEL_CLIPE_DIAKIDS_V05.mp4"
    },
    {
      "start-time": "06:10:59",
      "in": 0.0,
      "out": 326.506,
      "duration": 326.506,
      "source": "/var/lib/ffplayout/tv-media/LEO_LULLY_TV_SHORT_v02.mp4"
    }
 ]
}

Or generate the playlist in a db file or mysql, then we can use a sql query to generate a xmltv

@linnikvv
Copy link

That would be great.)

@jb-alvarado
Copy link
Member

You can add any information to the existing playlist, for playout the extra values got just ignored. But the start time could also be generated automatically per request.

When I inspect your xml, you have for every item this block:

 <programme start="20221017162401 -0300" stop="20221017182237 -0300" channel="1">
    <title lang="pt"> Linha de Ação</title>
    <desc lang="pt">Um ex-policial é envolvido em um escândalo após ser chamado pelo prefeito de Nova York para seguir a esposa do político que desconfia de infidelidade da mulher. Ao perceber que foi enganado o detetive sai em busca de justiça.</desc>
    <credits>
      <director> Allen Hughes</director>
      <actor> Mark Wahlberg, Russell Crowe, Catherine Zeta-Jones, Jeffrey Wright, Barry Pepper, Alona Tal, Natalie Martinez, Michael Beach, Kyle Chandler,</actor>
    </credits>
	<date> 2013</date>
    <category lang="pt"> Thriller Crime Drama</category>
    <image>
          <image_name>lZ9OGovrjamAVz3n6TjJts2npxE.jpg</image_name>
    </image>
    <country lang="pt"> United States of America</country>
    <star-rating system="IMdb">
      <value>2.95</value>
    </star-rating>
    <rating>
      <value></value>
    </rating>
  </programme>

The most of this values are not exists, for that you need a database. If you are fine with name from file, start time and duration, we can think about a API endpoint.

@cooliobr
Copy link
Author

You can add any information to the existing playlist, for playout the extra values got just ignored. But the start time could also be generated automatically per request.

When I inspect your xml, you have for every item this block:

 <programme start="20221017162401 -0300" stop="20221017182237 -0300" channel="1">
    <title lang="pt"> Linha de Ação</title>
    <desc lang="pt">Um ex-policial é envolvido em um escândalo após ser chamado pelo prefeito de Nova York para seguir a esposa do político que desconfia de infidelidade da mulher. Ao perceber que foi enganado o detetive sai em busca de justiça.</desc>
    <credits>
      <director> Allen Hughes</director>
      <actor> Mark Wahlberg, Russell Crowe, Catherine Zeta-Jones, Jeffrey Wright, Barry Pepper, Alona Tal, Natalie Martinez, Michael Beach, Kyle Chandler,</actor>
    </credits>
	<date> 2013</date>
    <category lang="pt"> Thriller Crime Drama</category>
    <image>
          <image_name>lZ9OGovrjamAVz3n6TjJts2npxE.jpg</image_name>
    </image>
    <country lang="pt"> United States of America</country>
    <star-rating system="IMdb">
      <value>2.95</value>
    </star-rating>
    <rating>
      <value></value>
    </rating>
  </programme>

The most of this values are not exists, for that you need a database. If you are fine with name from file, start time and duration, we can think about a API endpoint.

yes, will be good, with start time I can set a point 1 ( start of first program) and point 2 ( end of first program and start of second program without include advertisement) with name of file I can get info from TMDB

@jb-alvarado
Copy link
Member

And should the output date based, for every day a xml? ? Or all from current day until no playlist exists?

@cooliobr
Copy link
Author

is better current day to end of playlist.
example:
"start-time": "2022-10-15 06:10:59", i dont know if you can do like this easy but this format is a default SQL datetime

@cooliobr
Copy link
Author

cooliobr commented Nov 1, 2022

about this API endpoint, is possible put only video file without path?
So, to make a easy EPG service it may have:
"source": "file.mp4"
"start-time": "2022-10-15 06:10:59"
"end-time": "2022-10-15 07:10:59"
with this is possible to import into a mysql and populate a full xmltv with all data based on TMDB

@jb-alvarado
Copy link
Member

I will expose the regex from storage section, so the user can extract the string he needs.

@cooliobr
Copy link
Author

cooliobr commented Nov 1, 2022

good, i will populate my databse with TMDB info

@jb-alvarado
Copy link
Member

jb-alvarado commented Nov 13, 2022

I think a bit more about this topic. First my question:

  1. Is it enough to give you a json api endpoint, with the information you need?
  2. Would it be enough when it gives you always a hole day? Or do you need a range, like: ?start_after=2022-11-12T12:15:00&start_before=2022-11-13T00:00:00
  3. Is it important that the endpoint can respond multiple days?
  4. Is it ok when the endpoint is auth protected?

My thinking was, when I create a endpoint which response XML, it is possible, but not really efficient. For every request it would have to read the playlist files, and when you expose the endpoint to the world and it comes many requests, it becomes a bottleneck. This kind of stuff should be made with a database.

@cooliobr
Copy link
Author

I think a bit more about this topic. First my question:

  1. Is it enough to give you a json api endpoint, with the information you need?
  2. Would it be enough when it gives you always a hole day? Or do you need a range, like: ?start_after=2022-11-12T12:15:00&start_before=2022-11-13T00:00:00
  3. Is it important that the endpoint can respond multiple days?
  4. Is it ok when the endpoint is auth protected?

My thinking was, when I create a endpoint which response XML, it is possible, but not really efficient. For every request it would have to read the playlist files, and when you expose the endpoint to the world and it comes many requests, it becomes a bottleneck. This kind of stuff should be made with a database.

H, good morning.
So, about your questions.

  1. Yes, a json endpoint is good, in my case, I can import this endpoint to mysql, many guys can use json to import to this response to database.
  2. What is better to you implement?
  3. Is possible json response a full playlist of month from day 1 to 30/31 ?
  4. Yes, auth protection is ok, as you can see on this Sample of script to manage future schedule json #234 post, auth is not a problem.

No need XML, json is better to Import data, xml cam be generated by another app, web or console.

PS.: One thing, is possible to prevent the playlist on frontend to do not exceed day end time, in my conf is 05:59:25 ? or put in other color is program exceed, is can prevent collision of programs when import to database. ( it is only a suggestion )

@jb-alvarado
Copy link
Member

2. What is better to you implement?

For me json is way better :-).

3. Is possible json response a full playlist of month from day 1 to 30/31 ?

That is to specific for me, I like to have it more generic, like with my example with start_after and start_before

PS.: One thing, is possible to prevent the playlist on frontend to do not exceed day end time, in my conf is 05:59:25 ? or put in other color is program exceed, is can prevent collision of programs when import to database. ( it is only a suggestion )

Can you explain it different? The config has no day end time, only day_start and length and that is important.

@cooliobr
Copy link
Author

2. What is better to you implement?

For me json is way better :-).

3. Is possible json response a full playlist of month from day 1 to 30/31 ?

That is to specific for me, I like to have it more generic, like with my example with start_after and start_before

PS.: One thing, is possible to prevent the playlist on frontend to do not exceed day end time, in my conf is 05:59:25 ? or put in other color is program exceed, is can prevent collision of programs when import to database. ( it is only a suggestion )

Can you explain it different? The config has no day end time, only day_start and length and that is important.

  1. if you do this, is ok(for me)

About my PS.: when we make a random or manual playlist in frontend, some files have different time length, some times one file on end of playlist have more duration that have time remain to start new day and it will conflict or no ? in this image you can see at 05:40:42 will start a movie with 00:42:55 duration ... I don't know if is better to put this movie with other color in playlist or reduce "Out" or both, reduce "Out" and put it with other color, if time of last movie is less than remain time, filler file will play correct?.
Captura de Tela 2022-11-13 às 08 28 18

@jb-alvarado
Copy link
Member

Thank you for explaining. When a playlist is longer then a day, the playout cut it at the right time. In your case the last clip will not play to the end, but until the day is finished. And yes, when the playlist is to short, the filler clip plays.

The playlist generation has definitely its limitations, because as I say on a other place, ffplayout way originally made to playout playlist, but not generating them. In my work we have a inhouse planing software, where we have all the videos in a database, and from that database we generate our playlists. This is way better, because you can work with more logics, like continuing series etc. It would be also more easy to generate xmltv, because all the informations are already in the database.

Now we work in the opposite direction, we generate a playlist and then use the data for putting in the database.

@cooliobr
Copy link
Author

Thank you for explaining. When a playlist is longer then a day, the playout cut it at the right time. In your case the last clip will not play to the end, but until the day is finished. And yes, when the playlist is to short, the filler clip plays.

this logic will be applied to playlist endpoint ?

The playlist generation has definitely its limitations, because as I say on a other place, ffplayout way originally made to playout playlist, but not generating them. In my work we have a inhouse planing software, where we have all the videos in a database, and from that database we generate our playlists. This is way better, because you can work with more logics, like continuing series etc. It would be also more easy to generate xmltv, because all the informations are already in the database.

Now we work in the opposite direction, we generate a playlist and then use the data for putting in the database.

Interesting, I have my videos in database too. with tmdbs and imdb records.

@jb-alvarado
Copy link
Member

this logic will be applied to playlist endpoint ?

The endpoint will take in to account the seek in and out value.

Interesting, I have my videos in database too. with tmdbs and imdb records.

Yes a DB is way more usefull for that, because you can fill it with all kind of informations, like actor, description, series number and name, genre. For the playlout this would be useless.

@cooliobr
Copy link
Author

this logic will be applied to playlist endpoint ?

The endpoint will take in to account the seek in and out value.

Interesting, I have my videos in database too. with tmdbs and imdb records.

Yes a DB is way more usefull for that, because you can fill it with all kind of informations, like actor, description, series number and name, genre. For the playlout this would be useless.

may in future you share your version with db :D

@jb-alvarado
Copy link
Member

For that a crowd founding would be needed ;-).

Back to the endpoint: is the end_time really needed? Because the end time is normally the start time from next clip.

@cooliobr
Copy link
Author

For that a crowd founding would be needed ;-).

Back to the endpoint: is the end_time really needed? Because the end time is normally the start time from next clip.

for the end_time is not needed, I can get it with start_time + duration ( duration of file ) so, not needed

@jb-alvarado
Copy link
Member

There is a first version, in my dev repo, if you want to give it a try.

jb-alvarado added a commit to jb-alvarado/ffplayout that referenced this issue Nov 14, 2022
@cooliobr
Copy link
Author

There is a first version, in my dev repo, if you want to give it a try.

i will try, thanks

@cooliobr
Copy link
Author

There is a first version, in my dev repo, if you want to give it a try.

working amazing, thanks for your sharing.

@jb-alvarado
Copy link
Member

Ok thanks, good to hear! I have to do some code optimizations, so it takes a bit until I will create a official release.

@cooliobr
Copy link
Author

For now i change only API i dont touch in ffplayout, i need change to use hardware acceleration. may in future you can put a on/off for hardware acceleration ( nvidia and intel :D ).

Please, how can i send some bitcoin or eth ?

@jb-alvarado
Copy link
Member

For now i change only API i dont touch in ffplayout, i need change to use hardware acceleration. may in future you can put a on/off for hardware acceleration ( nvidia and intel :D ).

For what do you need hardware acceleration? For decoding? Does it really make so much different? A on/off I can not imagine at the moment, but maybe I could expose more custom ffmpeg setting to the config, and then is up to you how you configure it.

Please, how can i send some bitcoin or eth ?

I don't have crypo wallets. If you want to make a donation you can do it with opencollective.

@cooliobr
Copy link
Author

cooliobr commented Nov 17, 2022

For now i change only API i dont touch in ffplayout, i need change to use hardware acceleration. may in future you can put a on/off for hardware acceleration ( nvidia and intel :D ).

For what do you need hardware acceleration? For decoding? Does it really make so much different? A on/off I can not imagine at the moment, but maybe I could expose more custom ffmpeg setting to the config, and then is up to you how you configure it.

With hardware acceleration i can put more channels, reduce CPU use and bust input of file and some differente color textures, with cuda for example, all colors give more "live", in scale_cuda or scale_npp the filter lanczos can give more stability to reduce image and set PTS from source movie if you need do some overlay
This is command generates by my version of ffplayout

ffmpeg -hide_banner -threads 4 -hwaccel cuvid -c:v h264_cuvid -fix_sub_duration -drop_second_field true -nostats -v level+error -i /var/lib/ffplayout/tv-media/movie.mp4 -filter_complex [0:v:0]scale_npp=1280:720:format=yuv420p,null[v];movie=/usr/share/ffplayout/HALLO_Plus.png[l0];[l0]format=rgba,colorchannelmixer=aa=0.6,hwupload_cuda[l];[v][l]overlay_cuda=main_w-overlay_w-50:33,realtime=speed=1.0000647243896712[vout0];[0:a:0]anull,volume=5[aout0];[0:a:1]anull,volume=5[aout1] -map [vout0] -map [aout0] -map [aout1] -c:v h264_nvenc -aspect 16:9 -r:v 30 -b:v 2200k -maxrate 2700k -bufsize 3100k -profile:v main -preset p4 -level 41 -delay 0 -ar 48000 -b:a 128k -c:a libfdk_aac -map 0:s:0 -c:s webvtt -muxdelay 0 -metadata:s:v:0 master-display=G(13248,34499)B(7500,2999)R(34000,15999)WP(15700,17550)L(10000000,100) -metadata:s:a:1 language=Por -metadata:s:a:0 language=Eng -colorspace:v bt709 -color_primaries:v bt709 -color_trc:v bt709 -color_range:v tv -f hls -hls_time 6 -hls_list_size 10 -g 60 -keyint_min 60 -hls_flags second_level_segment_index+append_list+omit_endlist+delete_segments+program_date_time -strftime 1 -var_stream_map v:0,agroup:audio,s:0,sgroup:subtitle,default:yes,language:Por a:0,agroup:audio,language:Eng,default:yes a:1,language:Por,agroup:audio -hls_segment_filename /usr/share/ffplayout/public/live/ch1/stream-%v-%%04d.ts /usr/share/ffplayout/public/live/ch1/stream_%v.m3u8

Please, how can i send some bitcoin or eth ?

I don't have crypo wallets. If you want to make a donation you can do it with opencollective.
good,i will.

How many channels in one machine you need ?
This is my old system, i will migrate to ffplayout soon.
Captura de Tela 2022-11-17 às 16 29 19

@jb-alvarado
Copy link
Member

With hardware acceleration i can put more channels, reduce CPU use and bust input of file and some differente color textures, with cuda for example, all colors give more "live", in scale_cuda or scale_npp the filter lanczos can give more stability to reduce image and set PTS from source movie if you need do some overlay

Ah ok, I understand. That is a bit more complicate, then just expose decoding settings to the config. For that matter a on/off switch makes more sense. I have to think about it.

jb-alvarado added a commit to jb-alvarado/ffplayout that referenced this issue Nov 27, 2022
@jb-alvarado
Copy link
Member

@cooliobr, do you know if there is a difference between scale_npp and scale_cuda?

@cooliobr
Copy link
Author

cooliobr commented Nov 30, 2022

@cooliobr, do you know if there is a difference between scale_npp and scale_cuda?

Hi, yes, scale_npp use native Nvidia Performance Primitives, it is like to use a core engine to process any image https://docs.nvidia.com/cuda/npp/index.html
and cuda is a external libs like https://github.com/FFmpeg/nv-codec-headers, it dont use full GPU support.

I to compile ffmpeg with npp, it maximize GPU to my use.

@jb-alvarado
Copy link
Member

jb-alvarado commented Nov 30, 2022

Ok, thanks! I though I can make an ordering for checking HW filters with this priority:

  1. npp
  2. cuda
  3. opencl
  4. vaapi

When one filters is not found, to looks for the next one, and so on. When no HW filter is found it fall back to software filtering.

@cooliobr
Copy link
Author

Ok, thanks! I though I can make an ordering for checking HW filters with this priority:

1. npp

2. cuda

3. opencl

4. vaapi

When one filters is not found, to looks for the next one, and so on. When no HW filter is found it fall back to software filtering.

  1. npp
  2. cuda
  3. qsv
  4. opencl
  5. vaapi

@cooliobr
Copy link
Author

👯‍♂️

@jb-alvarado
Copy link
Member

The documentation don't say something about qsv filters. Is there some in the master branch?

@cooliobr
Copy link
Author

The documentation don't say something about qsv filters. Is there some in the master branch?

yes
https://trac.ffmpeg.org/wiki/Hardware/QuickSync

@catalinx3006
Copy link

Sorry, EPG is only a schedule, is not a ffmpeg issue. example: i made this EPG http://200.194.238.236/rundown/index.php?ch=1 and it give to me a XML http://200.194.238.236/rundown/epg.php then i can give it to cable operator.

hi, how can i export epg like here?

thanks

@cooliobr
Copy link
Author

Sorry, EPG is only a schedule, is not a ffmpeg issue. example: i made this EPG http://200.194.238.236/rundown/index.php?ch=1 and it give to me a XML http://200.194.238.236/rundown/epg.php then i can give it to cable operator.

hi, how can i export epg like here?

thanks

#234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants