webm dash encoding… What are the correct ffmpeg parameters?

后端 未结 2 585
野趣味
野趣味 2021-02-03 16:07

I\'m stumped with encoding videos into a dash compliant format. I\'m going from .mp4 to .webm

Firstly, I am running OS X and ffmpeg 2.5.4.

Here\'s the encoding c

相关标签:
2条回答
  • 2021-02-03 16:51

    Ok, here goes, managed to solve this. Hopefully this will save someone else some hassles.

    Firstly, here's the solution.

    Step 1: (strip audio from video, and create single audio file)

    ffmpeg -i IMG_0113.mp4 -c:v libvpx -s 160x90 -threads 4 -b:v 25k -tile-columns 4 -frame-parallel 1 -an -keyint_min 30 -g 30 -f webm video_160x90_25k.webm
    
    ffmpeg -i IMG_0113.mp4 -c:v libvpx -s 160x90 -threads 4 -b:v 50k -tile-columns 4 -frame-parallel 1 -an -keyint_min 30 -g 30 -f webm video_160x90_50k.webm
    
    ffmpeg -i IMG_0113.mp4 -vn -acodec libvorbis -ab 128k audio_128k.webm
    

    Step 2: (using sample_muxer from the libwebm project available here, to create the video cue points)

    mkvmuxer_sample -i video_160x90_25k.webm -o video_160x90_25k_cued.webm
    
    mkvmuxer_sample -i video_160x90_50k.webm -o video_160x90_50k_cued.webm
    

    Step 3: (Use ffmpeg to create the audio cue points)

    ffmpeg -i audio_128k.webm -vn -acodec libvorbis -ab 128k -dash 1 audio_128k_cued.webm
    

    Step 4: (Use ffmpeg to create the webm dash manifest file .mpd)

    ffmpeg -f webm_dash_manifest -i video_160x90_25k_cued.webm -f webm_dash_manifest -i video_160x90_50k_cued.webm -f webm_dash_manifest -i audio_128k_cued.webm -c copy -map 0 -map 1 -map 2 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2" manifest.mpd
    

    Secondly, here's the explanation.

    ffmpeg (my version atleast), was not creating the cue points in the video files correctly (when adding the -dash 1) param. I determined this by probing the video files, and by understanding the webm file format (read this, if you'd like to know more).

    I then stumbled upon sample_muxer from reading this page, and decided to see if it would better handle the video cue points that ffmpeg wasn't getting right. Whoop Whoop, it did!

    I noticed that the cue points in the extracted audio file from ffmpeg (using the -dash 1 param), were being created correctly!

    The ffmpeg generation of the webm dash manifest is also working nicely!

    For playing back the video, I found shaka-player worked best but I could not use it as I required video playback from a cefpython container and the shaka-player did not work on the latest cef (chromium embedded framework) included in the cefpython release.

    I then wrote my own player based off of this helpful site from google

    Anyway, hope this helps someone

    0 讨论(0)
  • 2021-02-03 16:59

    I had similar issue. When I converted mpeg2 to vp9 with ffmpeg v3.4.2, the output video was not seekable in VLC player (seeking took long time). When I tried ffmpeg v4.0.2, the video was seekable in VLC player. So it seems, that it is fixed in ffmpeg v4.0.2

    0 讨论(0)
提交回复
热议问题