asapach / peerflix-server

Streaming torrent client for Node.js with web ui.
MIT License
1.31k stars 588 forks source link

Add info video codec and transcoding FFMPEG #19

Open diaskooo opened 9 years ago

diaskooo commented 9 years ago

Hello. Not all files are shown on TV because of codecs especially MKV files if the codec is not MP4 Perhaps add transcoding on the fly using FFMPEG? And to add to informtsiyu video file codecs video and audio, resolution, etc. in response json

asapach commented 9 years ago

I need to think about it. I'm not sure if ffmpeg will support proper streaming over torrent-stream. I'll take a look at https://github.com/fluent-ffmpeg/node-fluent-ffmpeg

diaskooo commented 9 years ago

Напишу на русском, так проще будет объяснить.

Можно глянуть еще вот это вариант https://github.com/trenskow/stream-transcoder.js

Было бы идеально если были такие варианты: 1) Ссылка на оригинальное видео 2) Transcoding c оригинальным качеством только кодеки менять видео и аудио 3) Transcoding с выбором качества видео (1080, 720, 480) и выбором доп настройками

asapach commented 9 years ago

See #20. If you append ?ffmpeg=probe to the end of the video URL it will return the metadata in JSON format. ?ffmpeg=remux will remux the file, e.g. will convert from MKV to MP4 without loss of video quality. If remuxing proves to be viable, I could also add transcoding.

asapach commented 9 years ago

It turns out that WEBM is a much more suitable alternative for streaming video (e.g. youtube uses it) and it has better browser support now. I've replaced remuxing with transcoding into webm: vp8 for video and vorbis for audio.

AMerkuri commented 9 years ago

How about instead of transcoding video into another format but adding support to open .mkv files right in VLC?

asapach commented 9 years ago

You can install the VLC browser plugin and it will handle .mkv files. You can also open the video in VLC manually by copying the link, opening VLC, then Media / Open Network Stream... (or Ctrl+N) and pasting the link there. No way to automate this from the browser, though. It might be possible to start VLC on the server machine, but you are better of using peerflix for that.

AMerkuri commented 9 years ago

I tried copying download link to VLC Media / Open Network Stream... it gives me output: Your input can't be opened: VLC is unable to open the MRL Check the log for details. And the log output. http://hastebin.com/zisojacexa.tex

I can download and play mkv just fine but I can't stream it to VLC?

asapach commented 9 years ago

Works for me: http://hastebin.com/eriwikilis.1c

AMerkuri commented 9 years ago

Strange.. It started to work for me now.. Many thanks for quick response(s)! :+1:

asapach commented 9 years ago

Another alternative to plain remuxing/transcoding could be HLS, an Apple proprietary protocol that is supported by iOS and Android, and some players including VLC (though might be problematic in the browser). The idea is that video is broken into 10-second segments and an index file is created that lists all the segments and their time codes. It should be relatively easy to transcode each individual segment on demand and the index file should allow seeking (with 10-second precision, but that's better than nothing).

Another option could be DASH, but it's much more complicated and not as widely supported.

Porco-Rosso commented 8 years ago

Any progress on this front?

also, is ?ffmpeg=remux working in the latest master? I seem to just get a 502 error, and am not sure if it is because of my nginx reverse proxy.

asapach commented 8 years ago

Yes, remuxing to WebM should be working. Please make sure that you have ffmpeg in your path: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#ffmpeg-and-ffprobe and check the console/logs for error messages.

Porco-Rosso commented 8 years ago

thanks, for future people who might read this, on Debian 8 I had to run:

echo deb deb http://www.deb-multimedia.org jessie main non-free \
                  >>/etc/apt/sources.list

Followed by

sudo apt-get update
sudo apt-get install deb-multimedia-keyring
sudo apt-get update
sudo apt-get install ffmpeg
stfl commented 6 years ago

I usually play it with mpv from the command line which uses ffmpeg like:

mpv "http://localhost..." --sub-file "http://localhost..."

works far better than "server-side" decoding or in-browser playing..