question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Video streaming over seekableStream doesn't work in VLC and ffplay

See original GitHub issue

I have some video files that are stored in database, that is why I cannot use staticFiles. I found that there is context.seekableStream method where I can just provide the stream and it will send it to the client honoring the RANGE header, that is why the seeking in video player should work.

Example to reproduce with local file:

public static void main(String[] args {
      System.out.println("Test video");
      Javalin app = Javalin.create().start(9090);
      app.get("/video", ctx -> {
          File videoFile = new File("./myVideoFile.mp4");
          ctx.result(new FileInputStream(videoFile));
      });
  }

If I open the link http://localhost/video in Google Chrome or Firefox, it is working, even the seeking back and forward works without any issue, but in developer console I see huge number of small requests(but I can live with them) I expect that it will work in other players.

Actual behavior (the bug) If I open the link in other player (VLC player, or ffplay http://localhost/video) the players could not properly play the file fully(ffprobe can play several seconds of video and then stops).

ffplay stops with the following error Stream ends prematurely at 128048, should be 7949807

Streaming the same file served with config.addStaticFiles(staticFiles -> { works without any issues in any player I tried

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
cplaunchercommented, Jul 8, 2022

I am not experienced in kotlin, but I will try to fix it and make PR

0reactions
tipsycommented, Oct 12, 2022

I’ll just go ahead and close this, feel free to reopen if you want to work on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix bad files and streams with ffmpeg so VLC and other ...
If parts of the file reside on physically bad sectors, or for whatever reason, the OS cannot serve the whole file to FFmpeg,...
Read more >
Cannot play video stream from FFMPEG to VLC - Super User
I'm trying to stream my local webcam using FFMPEG. For test purposes, I'm doing this locally and try to open the stream using...
Read more >
Streaming video to embedded VLC via ASP.Net - Stack Overflow
I am trying to write a video streaming site using an embedded VLC control to play the video and an asp.net handler to...
Read more >
Cannot seek .ts file over a network (SMB or FTP) - GitLab
I can play these .ts files over the network on the Windows... ... it produces an error "Unseekable Stream" when I try to...
Read more >
Make vlc more resilent with unreliable streaming content
1. Go to File/Open network stream · 2. Write or paste the address of a network stream, for example http://mediapolis.rai.it/relinker/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found