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

Usage examples #28

Closed
rezaalimorady opened this issue Dec 5, 2021 · 29 comments
Closed

Usage examples #28

rezaalimorady opened this issue Dec 5, 2021 · 29 comments
Labels
documentation Improvements or additions to documentation

Comments

@rezaalimorady
Copy link

Hello
could you share some of usage example for this module?
TNX

@rezaalimorady
Copy link
Author

for example i have a mp4 file in /media directory
4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4

and i want the index file -> with this url
http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/index.m3u8
and it returns :
500 unable to preload metadata

docker-compose logs:

go-transcode    | 12:08PM WRN unable to preload metadata error="unable probe media for metadata: exit status 1" module=hlsvod
go-transcode    | 12:08PM DBG request complete (500) module=http req={"agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36","id":"b7e509d9545f/KM6lrEb4VP-000020","method":"GET","proto":"HTTP/1.1","remote":"172.18.0.1:35092","scheme":"http","uri":"http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/index.m3u8"} res={"bytes":31,"elapsed":22.711615,"status":500,"time":"Sun, 05 Dec 2021 12:08:20 UTC"}

config.yaml file :

# allow debug outputs
debug: true

# mount debug pprof endpoint at /debug/pprof/
pprof: true

# bind server to IP:PORT (use :8888 for all connections)
bind: localhost:8080

# serve static files from this directory (optional)
static: /var/www/html

# TODO: issue #4
proxy: true

# For live streaming
streams:
  cam: rtmp://localhost/live/cam
  ch1_hd: http://localhost:9981/stream/channelid/85
  ch2_hd: http://localhost:9981/stream/channelid/43

# For static files
vod:
  # Source, where are static files, that will be transcoded
  media-dir: ./media
  # Temporary transcode output directory, if empty, default tmp folder will be used
  transcode-dir: ./transcode
  # Available video profiles
  video-profiles:
    360p:
      width: 640 # px
      height: 360 # px
      bitrate: 800 # kbps
    540p:
      width: 960
      height: 540
      bitrate: 1800
    720p:
      width: 1280
      height: 720
      bitrate: 2800
    1080p:
      width: 1920
      height: 1080
      bitrate: 5000
  # Use video keyframes as existing reference for chunks split
  # Using this might cause long probing times in order to get
  # all keyframes - therefore they should be cached
  video-keyframes: false
  # Single audio profile used
  audio-profile:
    bitrate: 192 # kbps
  # If cache is enabled
  cache: true
  # If dir is empty, cache will be stored in the same directory as media source
  # If not empty, cache files will be saved to specified directory
  cache-dir: ./cache
  # Use custom ffmpeg & ffprobe binary paths
  ffmpeg-binary: ffmpeg
  ffprobe-binary: ffmpeg

# For proxying HLS streams
hls-proxy:
  my_server: http://localhost:9981

what should i do for index.m3u8 file for a mp4?

@rezaalimorady
Copy link
Author

Any document for this module?

@rezaalimorady rezaalimorady changed the title could you share some usage example for this module? Usage examples Dec 5, 2021
@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

Yes, adding usage examples for all modules would be needed.

Quick question, do you have ffmpeg installed? If it cannot preload metdata, it might be because of missing ffmpeg. Or do you use docker image?

And you say your files are in /media but in config it is ./media. Is that expected?

@rezaalimorady
Copy link
Author

Thanks
ffmpeg installed before

image

i used your docker-compose for build
I think its about my media-dir: /media

i use /media directory for videos. what should i put in config.yaml -> media-dir: -----

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

If you use /media, then media-dir: /media should be the correct entry.

@rezaalimorady
Copy link
Author

image

still problem exist

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

Your config file is mounted as volume to docker, right? And after changing it you restarted the container and it does not work, correct?

@rezaalimorady
Copy link
Author

absolutely yes

image

and this is my /media directory.

image

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

Can you try to execute ffprobe on that file inside container, to rule out all permissions issues?

Something like this:

docker-compose exec go-transcode ffprobe /media/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4

@rezaalimorady
Copy link
Author

could not find the file from inside docker

image

from outside container it works

image

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

Is it mounted correctly? With - ./media:/media.

version: "3"

services:
  go-transcode:
    build: . # path to go-transcode repository
    container_name: go-transcode
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - ./config.yaml:/app/config.yaml
      - ./media:/media
    command: serve -d

UPDATE: or - /media:/media.

@rezaalimorady
Copy link
Author

rezaalimorady commented Dec 5, 2021

ffprobe fixed
when i correct my docker-compose

image

but the URL -> http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/index.m3u8
still dosn't return anything

docker-compose logs -f

go-transcode    | 1:17PM WRN unable to preload metadata error="unable probe media for metadata: exit status 1" module=hlsvod
go-transcode    | 1:17PM DBG request complete (500) module=http req={"agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36","id":"d03e06e9d058/03MFNWvPjp-000002","method":"GET","proto":"HTTP/1.1","remote":"172.18.0.1:56356","scheme":"http","uri":"http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/index.m3u8"} res={"bytes":31,"elapsed":22.090266,"status":500,"time":"Sun, 05 Dec 2021 13:17:36 UTC"}
go-transcode    | 1:17PM INF fetching metadata module=hlsvod submodule=manager

@rezaalimorady
Copy link
Author

image

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

Just noticed! I have mistake in readme:

  ffmpeg-binary: ffmpeg
  ffprobe-binary: ffmpeg

ffprobe-binary should be ffprobe, but it is ffmpeg. That is why show_format is unrecognized. Gonna fix that, thanks!

m1k1o added a commit that referenced this issue Dec 5, 2021
@rezaalimorady
Copy link
Author

No problem dear.
i change it
but still same problem
image

its into docker image:
image

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

It looks like, error persists and ffmpeg is still called (because of the show_format error). Could you try to recreate your container, to be sure, changes were applied?

m1k1o added a commit that referenced this issue Dec 5, 2021
@rezaalimorady
Copy link
Author

completly remove it
image

config inside docker image
image

and ffprobe error not show
there is another error :)
image

@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

I see that your cache dir does not exist. I just noticed that might be error and fixed in c26cba0.

If you want to keep your cache along with the files, you can remove cache-dir: ./bin/cache this line. Or specify directory, that exists (mount it in docker compose).

m1k1o added a commit that referenced this issue Dec 5, 2021
@m1k1o
Copy link
Owner

m1k1o commented Dec 5, 2021

Added usage examples.

@rezaalimorady
Copy link
Author

rezaalimorady commented Dec 6, 2021

Thanks bro.
I pulled last changes and problem fixed.
but this url -> http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/index.m3u8
not retun completly manifest file
image

and of course using `ffplay` . return err
http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/index.m3u8: Invalid data found when processing input

@rezaalimorady
Copy link
Author

rezaalimorady commented Dec 6, 2021

Thanks for adding usage examples :)
please add usage example for profile or multi probile/bitrate manifest.
and how can add new profile or change current profile

@m1k1o
Copy link
Owner

m1k1o commented Dec 6, 2021

If the master playlist is empty, that can mean, your video resolution is lower than the lowest profile. You can try to get the profile directly. E.g. http://localhost:8080/vod/4f9c8335-90b1-4551-a59d-7534bc553057_360.mp4/360p.m3u8 and it should work.

I consider adding the lowest profile all the time, because it should never return empty playlist.

@rezaalimorady
Copy link
Author

@m1k1o
Copy link
Owner

m1k1o commented Dec 7, 2021

What is the resolution of the video? There is also no point in upscaling, if it is not 1080p. I can though leave at least the lowest one in all cases.

@rezaalimorady
Copy link
Author

i use a 1080 video -> http://localhost:8080/vod/17bb20ab-4028-4e2f-acb4-619e4d79c8da_1080.mp4/index.m3u8

the output is like :

#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=945000,RESOLUTION=640x360,NAME=360p
360p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1995000,RESOLUTION=960x540,NAME=540p
540p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=3045000,RESOLUTION=1280x720,NAME=720p
720p.m3u8

why 1080 profile not in index file?
how could i config these.

@rezaalimorady
Copy link
Author

rezaalimorady commented Dec 7, 2021

and how about subtitles?
how could i add subtitle track?

@rezaalimorady
Copy link
Author

I hope your team write powerfull document for this module.
really needed

@m1k1o
Copy link
Owner

m1k1o commented Dec 7, 2021

why 1080 profile not in index file?

It looks like a bug, I'll look into this. It should be visible.

I hope your team write powerful document for this module.

My team consist of only me right now. Contributors are welcomed. This module is experimental now and thanks to the people who use it and give me feedback, like you, I can catch lots of bugs and make it better for everyone.

and how about subtitles?

That is on roadmap. Hopefully soon will be supported.

@rezaalimorady
Copy link
Author

Thank you for your patient response :)
Hopefully being best.

@m1k1o m1k1o added the documentation Improvements or additions to documentation label Dec 8, 2021
@m1k1o m1k1o closed this as completed Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants