segator / proxylive

This application allow you to transcode and broadcast on demand a http mpeg ts to transcoded mpegts/hls
MIT License
59 stars 21 forks source link

Error running docker Mac OSX Mojave #5

Closed ghost closed 5 years ago

ghost commented 5 years ago

When I try to run the docker with this command:

docker run -it -v /Users/<MY_USERNAME>/Downloads/docker_shared/application.yml:/app/application.yml segator/proxylive

where /Users/<MY_USERNAME>/Downloads/docker_shared/application.yml looks like this:

source:

My Tvheadend source instance

tvheadendurl: http://192.168.0.1:9981/stream/channel/{id}
#In case of source connection problem, retry connection in 10 seconds
reconnectTimeout: 10

streamTimeout: 60

Client Stream timeout, if no bytes from backend on this timeout range, the client connection will be closed

internalConnection: true

all tasks always try to connect to proxylive(loop) instead of direct to tvheadend.

Pros:

-Single connection to tvheadend per channel

-when 2 clients with HLS and mpegTS with the same transcoding profile only transcoded one time.(so less cpu usage)

Cons:

-Slower start when the channel is not yet initialized on HLS/or mpegTs with transcoding.

ffmpeg: path: '/usr/bin/ffmpeg' profiles:

        alias: "aac"
        parameters: "-sn -c:a:0 aac -b:a 320k -c:v copy"
    -
        alias: "360p"
        parameters: "-sn -c:a:0 aac -b:a 128k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 3.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 700k  -preset veryfast -vf scale=-1:360,yadif=0"
    -
        alias: "480p"
        parameters: "-sn -c:a:0 aac -b:a 196k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 3.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 1500k  -preset veryfast -vf scale=-1:480,yadif=0"
    -
        alias: "720p"
        parameters: "-sn  -c:a:0 aac -b:a 320k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 3000k  -preset veryfast -vf scale=-1:720,yadif=0"
    -
        alias: "1080p"
        parameters:  "-sn  -c:a:0 aac -b:a 320k -c:v libx264 -tune zerolatency -g 300 -vprofile high -level 4.0 -movflags +faststart -bufsize 15000k -maxrate 5000k  -preset veryfast -vf yadif=0"
mpegTS:
    parameters: "-threads 0 -f mpegts -mpegts_m2ts_mode 1 -mpegts_copyts 1 -mpegts_flags +resend_headers  "
    #Specific parameters for mpegTS(only works if a diferent profile than raw is selected, raw send direct data from backend so no transcoded, in this case not applied this parameter.
hls:
    tempPath: "/tmp"
    #Path where HLS will save segment files and playlist
    parameters: "-flags -global_header  -avoid_negative_ts disabled -map_metadata -1 -start_at_zero -copyts -flags -global_header -vsync cfr -y -nostats -f hls  -hls_time 2 -hls_list_size 10 -hls_wrap 20 -hls_allow_cache 0  -hls_flags +append_list -hls_flags +discont_start -hls_flags +delete_segments"
    #FFmpeg parameters specific for HLS     
    timeout: 120
    #When user disconnect from stream, we doesnt have any way to be sure the user is totally disconnected so this parameter control how many seconds since last download of a segment of a concret stream, if the timeout is reached, the timeout is canceled.

buffers:

The max amount of bytes the application can read from a stream, default 1MB

chunkSize: 1048576
#Buffer size of the broadcast buffer,larger buffer more stable but larger delay than source stream, default 50MB
broadcastBufferSize: 52428800

Override the endpoint in the playlist(optional)

endpoint: https://myendpoint.com

The 192.168.0.1:9981 is where I have tvheadend running. I go this error:

019-02-11 20:55:51.406 INFO 7 --- [ main] c.github.segator.proxylive.Application : No active profile set, falling back to default profiles: default 2019-02-11 20:55:51.447 INFO 7 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@131276c2: startup date [Mon Feb 11 20:55:51 UTC 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1ee0005 2019-02-11 20:55:52.238 INFO 7 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=470aa287-ebaf-30e8-88c4-3a2a275def5d 2019-02-11 20:55:52.337 INFO 7 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$80b05bf9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-02-11 20:55:52.750 INFO 7 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) 2019-02-11 20:55:52.779 INFO 7 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2019-02-11 20:55:52.782 INFO 7 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.27 2019-02-11 20:55:52.925 INFO 7 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2019-02-11 20:55:52.927 INFO 7 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1479 ms 2019-02-11 20:55:53.081 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2019-02-11 20:55:53.087 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/] 2019-02-11 20:55:53.088 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/] 2019-02-11 20:55:53.089 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/] 2019-02-11 20:55:53.090 INFO 7 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/] 2019-02-11 20:55:53.261 WARN 7 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'streamController': Unsatisfied dependency expressed through field 'channelService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createChannelService': Invocation of init method failed; nested exception is java.net.UnknownHostException: tvheadend 2019-02-11 20:55:53.268 INFO 7 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2019-02-11 20:55:53.308 INFO 7 --- [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2019-02-11 20:55:53.329 ERROR 7 --- [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'streamController': Unsatisfied dependency expressed through field 'channelService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createChannelService': Invocation of init method failed; nested exception is java.net.UnknownHostException: tvheadend .....

Any help?

Thanks

segator commented 5 years ago

Sorry the doc is out of date, i did some modifications recently to support non tvheadend backends so config is diferent, check this file https://github.com/segator/proxylive/blob/master/src/main/resources/application.yml. I will update docs soon

segator commented 5 years ago

Let me know if i can help

ghost commented 5 years ago

@segator The error regarding host is now solved, but getting a new error:

Caused by: java.lang.Exception: Error loading Picons
at com.github.segator.proxylive.service.ChannelTVHeadendService.buildChannels(ChannelTVHeadendService.java:106) ~[classes!/:1.0-SNAPSHOT] at com.github.segator.proxylive.service.ChannelTVHeadendService.getDataFromTvheadend(ChannelTVHeadendService.java:184) ~[classes!/:1.0-SNAPSHOT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]

I don't use Picons in my tvheaded configuration. It this the cause?

Here is my application.yml file:

spring.jackson.serialization.INDENT_OUTPUT: true
source:
    tvheadendURL:  http://my_username:my_pass@192.168.0.1:9981
    epg:
        #url: http://user:pass@localhost/xmltv.xml or file://path/xmltv.xml exec://usr/bin/tv_grab_whatever
        url: http://my_username:my_pass@192.168.0.1:9981/xmltv/channels
        refresh: 600
    channels:
        #url: http://mywebserver/my.json || file://my.json
        #type: json
        url: http://my_username:my_pass@192.168.0.1:9981/playlist
        type: tvheadend
        refresh: 300
    reconnectTimeout: 10
streamTimeout: 30
internalConnection: true
ffmpeg:
    path: ffmpeg
    profiles:
        -
            alias: "aac"
            parameters: "-sn -ac 2 -c:a aac -b:a 320k -c:v copy"
        -
            alias: "240p"
            parameters: "-sn -c:a:0 aac -ac 2 -b:a 64k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 300k  -preset veryslow -vf scale=-1:244,yadif=0"
        -
            alias: "360p"
            parameters: "-sn -c:a:0 aac -ac 2 -b:a 96k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 700k  -preset veryslow -vf scale=-1:360,yadif=0"
        -
            alias: "480p"
            parameters: "-sn -c:a:0 aac -ac 2 -b:a 196k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 1500k  -preset slow -vf scale=-1:484,yadif=0"
        -
            alias: "720p"
            parameters: "-sn  -c:a:0 aac -ac 2 -b:a 320k -c:v libx264 -tune zerolatency -g 10 -vprofile high -level 4.0 -crf 18 -movflags +faststart -bufsize 15000k -maxrate 3000k  -preset fast -vf scale=-1:720,yadif=0"
        -
            alias: "1080p"
            parameters:  "-sn  -c:a:0 aac -ac 2 -b:a 320k -c:v libx264 -tune zerolatency -g 300 -vprofile high -level 4.0 -movflags +faststart -bufsize 15000k -maxrate 5000k  -preset faster -vf yadif=0"
    mpegTS:
        parameters: "-threads 0 -f mpegts -mpegts_m2ts_mode 1 -mpegts_copyts 1 -mpegts_flags +resend_headers  "
    hls:
        tempPath: "/tmp"
        parameters: "-flags -global_header  -avoid_negative_ts disabled -map_metadata -1 -start_at_zero -copyts -flags -global_header -vsync cfr -y -nostats -f hls  -hls_time 2 -hls_list_size 10  -hls_flags delete_segments  -hls_flags +append_list -hls_flags +discont_start -hls_flags +delete_segments"
        timeout: 30

buffers:
    chunkSize: 131072
    broadcastBufferSize: 52428800
segator commented 5 years ago

weird I tried to load channels with no picon and worked. Could you send me pictures of your General Tvheadend Configuration "Channel icon/Picon settings"

and Channels user picon. The fix probably will be so easy but first I need to reproduce it.

ghost commented 5 years ago

Screenshots:

screenshot 2019-02-13 at 18 48 08

screenshot 2019-02-13 at 18 50 02

segator commented 5 years ago

I just commit a modification that will show more errors when crash, could you recompile and try the new version, it will crash but at least I will get more details because im not able to reproduce the error with the same configuration that you have.

ghost commented 5 years ago

Error Log:

Updating Channel Info Updating Channel:0c1c188089a52b009e0e2abf2a2db8ab 2019-02-13 19:57:39.747 WARN 7 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'streamController': Unsatisfied dependency expressed through field 'channelService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createChannelService': Invocation of init method failed; nested exception is java.lang.Exception: Error loading Picons error:1 Unknown Code 2019-02-13 19:57:39.751 INFO 7 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2019-02-13 19:57:39.814 INFO 7 --- [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2019-02-13 19:57:39.831 ERROR 7 --- [ main] o.s.boot.SpringApplication : Application startup failed

segator commented 5 years ago

I just did a modification, now should works, let me know if works for you.

ghost commented 5 years ago

Its working now. Thanks a lot ;)