1. 20
  1.  

  2. 6

    Very handy and to the point! I appreciate you writing it.

    My only small quibble is that HVEC is a proprietary codec. MDN’s video codec guide recommends using a WebM container with VP9 for video and Opus for audio, for everyday videos.

    1. 1

      Thanks for your feedback. I’m very interested on your quibble. Have already tried to upload a video with WebM container with VP9 for video and Opus for Audio ? Do you have any recommended FFmpeg command parameters to produce a file like that so that I can try locally and than update my article ?

      1. 3

        I have made quite a few video clips encoded with VP9, but AAC (edit: double checking my files, ffmpeg seems to have transcoded audio to Opus automatically) as audio and my experience is that a lot of devices have shoddy support for VP9. For the ones that support it, it is great, but for the ones where it doesn’t then you will need a fallback to h264. Depends on your use case here.

        Regarding the conversion parameters I often convert h264 encoded videos to VP9 using these settings: ffmpeg -i <input_file> -c:v libvpx-vp9 -crf 18 -b:v 0 <output_file>

        Works fine for me in my case, but I’ve never tried to upload them to mastodon, so… YMMV I guess?

        1. 2

          Or VP8 which will be a bit bigger but has broader performant decoding support.

          1. 1

            This is the reasonable option…

          2. 1

            Thanks for these details from your experience. Do you think you can try to upload a file generated that way on mastodon and see if it works ?

            1. 1

              I don’t have an account, but I can PM you a link to a file you can test with that is encoded in that way that you could test with if you want.

          3. 2

            I have not tried it, actually; I will today, if you’d like. In the process, I’ll figure out the FFmpeg parameters needed.

            1. 1

              Thank you very much, that would be helpful. I’m open to update my article based on the MDN’s recommendations.

              1. 4

                I’ve uploaded a one (1) minute clip to: https://emacs.ch/@carcosa/109365376767283805

                The command-line I used was:

                ffmpeg -i 'Sacrifice of Angels Battle.mp4' -vf scale=1920:-1 -c:v libvpx-vp9 -crf 24 -b:v 2000k -row-mt 1 -c:a libopus -b:a 48K 'Sacrifice of Angels Battle.webm'

                1. 2

                  The audio is way out of sync, dunno if that’s your fault or the source material

        2. 2

          It will be interesting to see how this goes. Most Mastodon servers don’t have a ton of storage or bandwidth, so if everyone starts doing 12MB attachments things could get interesting.

          1. 2

            I wonder if we’re approaching this incorrectly.

            It would seem that it’d be easier to have the client do this and do the check, rather than offload it to the server.

            And that project is here: https://github.com/ffmpegwasm/ffmpeg.wasm

            I believe there’s webassembly Linux images to run a single command like ffMpeg. Seems like those disk images could be cached, and used client side to do the thing.

            The storage is still used on server side, but now with no extra CPUram load on conversions.

            And I know more than a few admins use AWS S3 as a media content backing store.

            1. 1

              Thanks all for comments here. I’ve just update the original suggested command parameter and I added an update sections. Feel free to check the article again and comment here.

              1. 1

                I see a lot of comments and I am very pleased.I will all listen to them during the day and answer you.I was committed to a conference and a workshop this weekend.