3

I'm building an application that records live tv (dvbt: mpeg.ts-files) and immediately transcodes it with ffmpeg to a webm file. I'm able to do that at a constant rate; so ffmpeg doesnt catch up the growing file.

Now I want to playback this file on an html5 website. This works, but when ffmpeg isn't done transcoding (and my webm-file is still growing), i'm not able to seek it (and there is no progress bar).

Is it possible to seek a video file while it is beeing transcoded? Am i missing some ffmpeg-settings? Or is webm the problem?

This is what I have now:

ffmpeg -re "inputfile.ts" -y -f webm -vcodec libvpx -acodec libvorbis \ 
       -aq 90 -ac 2 -b:v 1300k -threads 2 "outputfile.webm"

Thank you

Eric Fortis
  • 16,372
  • 6
  • 41
  • 62
Erik
  • 87
  • 1
  • 8

1 Answers1

1

I don't know that this will help, but I've worked on a solution similar to yours with ffmpeg transcoding to flash for streaming on the web. The method for seeking required JavaScript in the player to gather the seek-to position, which would then change the player's URL, telling the back-end to start streaming again from the new position, something like :

http://server/player.php?video=x.flv&pos=1838

On the back-end, the ffmpeg command would be something like:

ffmpeg -y -ss 1838 -i x.mpg -s 320x240 -g 30 -r 24 -f flv -deinterlace -ac 1 -ar 11025 -ab 64k -b 256k

However, the problem I ran into was that -ss causes ffmpeg to take a snapshot of the video when seeking. Therefore if the video was a live recording (still being written to), the transcoded stream would end once playback reached the "relative end" (the point in time where the ending was when streaming started). I still have not found a solution to this problem.

If you're not interested in watching live recordings, I think a similar method might work for you - if you have a method of injecting JavaScript into your HTML5 player.

Stephan
  • 41,764
  • 65
  • 238
  • 329