News for hackers. Stuff that matters.
Re:Ask HN: Share your FFmpeg settings for video hosting by Am4TIfIsER0ppos on Sunday July 21, 2024 @07:21PM (#41029268)
For synchronized group watching I typically encode to h264 and aac in mp4. Video: render subtitles if available, downscale to 720p if larger, ensure yuv420p, encode with: preset slow, crf 24, and tune animation or film as appropriate. Copy audio if aac, 2 channel, and bitrate is less than 160k otherwise: force 2 channel, encode at 128k. Fast start is needed otherwise I'd use a separate program to put the "header" at the start.

As for your command line, what do you think -g 52 does? Why do you give conflicting audio channel settings?

Re:Ask HN: Share your FFmpeg settings for video hosting by indulona on Monday July 22, 2024 @02:22AM (#41031390)
-g 52 = at the latest every 52nd frame will be a key-frame(so little over 2 seconds at 24 fps), this influences seeking(how long an image might have artifacts before it renders properly). there are no two conflicting audio channels settings. the -ar is audio sampling rate(data points per second) whereas -maxrate:a is bitrate(actual bits of data per second). the yuv is good point, i guess i is a safe-guard for exotic input. also, copying the audio might be worth it, although then i would end up with mixed output files where one might be original aac and another might be opus. so i think i prefer the uniform output over some saving in processing.
Re:Ask HN: Share your FFmpeg settings for video hosting by Am4TIfIsER0ppos on Monday July 22, 2024 @05:01AM (#41032224)
Okay there is some thought put into your choice of keyframe interval.

And there is a conflict. You allow the aformat filter to negotiate for 5.1, 7.1, or stereo but then insist there must be 2 audio channels.

I copy the audio when it is suitable just to save another lossy encode.

Re:Ask HN: Share your FFmpeg settings for video hosting by indulona on Monday July 22, 2024 @08:26AM (#41033612)
Re:Ask HN: Share your FFmpeg settings for video hosting by atoav on Wednesday July 24, 2024 @07:24AM (#41055795)
Ensuring yuv410p is the real important addition of this post. If you don't do that, depending on the user input you will end up with a mp4 that won't play.

AAC is more standard for mp4 video than opus, although I agree opus is the superior CODEC. Whether the benefits of opus outweigh the downsides of it being non-standard in your usecase is not mine to decide, but if you are looking to produce a thing that is similar to most other web video things out there I'd go with AAC. The saved bandwith is probably miniscule in comparison to what you could save on the video side.

Re:Ask HN: Share your FFmpeg settings for video hosting by ccvannorman on Wednesday July 24, 2024 @08:02AM (#41056073)
Seconding this: adding "-pix_fmt yuv420p" to your conversion will ensure compatibility, for example if you try attaching a converted MP4 to a WhatsApp chat, it will not show a preview or play unless you include this flag.
Re:Ask HN: Share your FFmpeg settings for video hosting by indulona on Wednesday July 24, 2024 @07:50AM (#41055978)
opus has no issues with support, why go with older aac then?
Re:Ask HN: Share your FFmpeg settings for video hosting by anotherhue on Wednesday July 24, 2024 @07:59AM (#41056056)
If you think opus has no issues you must not have tested many devices.

If your subset handles it, great, but don't be dismissive.

Re:Ask HN: Share your FFmpeg settings for video hosting by indulona on Wednesday July 24, 2024 @10:08AM (#41057290)
like nokia 3110 from 1998? :D
Re:Ask HN: Share your FFmpeg settings for video hosting by deicidist on Wednesday July 24, 2024 @01:06PM (#41059216)
Like Rokus from 2019.
Re:Ask HN: Share your FFmpeg settings for video hosting by atoav on Wednesday July 24, 2024 @08:48AM (#41056521)
Many users of youtube/Vimeo are used to supplying their files like that. Most GUI tools won't have Opus. So if you care about your users delivering already encoded files AAC might be the wiser choice.

This depends on your target audience however