leonid-shevtsov / headless

Create a virtual X screen from Ruby, record videos and take screenshots.
http://leonid.shevtsov.me/en/headless
MIT License
968 stars 113 forks source link

How could I produce a fragmented mp4? #79

Closed MaxPleaner closed 8 years ago

MaxPleaner commented 8 years ago

I've found that I can use the headless gem to create an mp4 like so:

  headless = Headless.new(video: {frame_rate: 12, codec: 'libx264'})
  headless.start
  headess.video.start_capture
  headless.stop_and_save("test.mp4")

And the mp4 file produces is playable.

How could I make this a fragmented mp4?

The readme shows that the following options are supported for the videos hash in Headless.new's options, but I'm not sure how to set them up:

:codec - codec to be used by ffmpeg
:frame_rate - frame rate of video capture
:provider - ffmpeg provider - either :libav (default) or :ffmpeg
:provider_binary_path - Explicit path to avconv or ffmpeg. Only required when the binary cannot be discovered on the system $PATH.
:pid_file_path - path to ffmpeg pid file, default: "/tmp/.headless_ffmpeg_#{@display}.pid"
:tmp_file_path - path to tmp video file, default: "/tmp/.headless_ffmpeg_#{@display}.mov"
:log_file_path - ffmpeg log file, default: "/dev/null"
:extra - array of extra ffmpeg options, default: []

The reason I want to make a fragmented mp4 is that it's streamable.

leonid-shevtsov commented 8 years ago

This isn't really a Headless issue, you can pass any additional options to ffmpeg through :extra, and a quick googling reveals the options you need for a fragmented mp4.

MaxPleaner commented 8 years ago

Well anyway thanks for your help On Jul 2, 2016 12:56 AM, "Leonid Shevtsov" notifications@github.com wrote:

This isn't really a Headless issue, you can pass any additional options to ffmpeg through :extra, and a quick googling reveals the options you need for a fragmented mp4 http://stackoverflow.com/questions/8616855/how-to-output-fragmented-mp4-with-ffmpeg#9734251 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leonid-shevtsov/headless/issues/79#issuecomment-230089712, or mute the thread https://github.com/notifications/unsubscribe/AEzWx2ldLN0qxfBI1WHnHBLqY_Xtaip6ks5qRhmNgaJpZM4JDiDg .