voc / voctomix

Full-HD Software Live-Video-Mixer in python
https://c3voc.de/
MIT License
579 stars 107 forks source link

Flv instead of Matroska? #230

Closed computersrmyfriends closed 5 years ago

computersrmyfriends commented 5 years ago

Is it possible to use flv instead of matroska? Is there any reason for using Matroska?

MaZderMind commented 5 years ago

We use MKV as an data exchange format. We transport uncompressed Video and an unlimited Number of Audio-Streams wrapped in Matroska. You can encode and downconvert from there to whatever you like, including flv, with an external process.

Take a look at https://github.com/voc/voctomix/blob/master/example-scripts/ffmpeg/stream-hd-to-youtube.sh for an example, that takes the uncompressed Stream from voctomix, encodes to h264/aac, wraps in flv and pushes that to youtube via the rtmp protocol.

computersrmyfriends commented 5 years ago

Hi. Thank you for the patient and kind explaination. Doesn't this double conversion to mkv and then again to flv add more cpu overhead? Can you please tell why we are limited to using only MKV as the exchange format? If my use was primarily to output to flv,then wouldn't using flv format as the intermediate save CPU usage since I can use "c:v copy c:a copy -f flv" instead of again doing a H.264 conversion from mkv?

Thanks.

markvdb commented 5 years ago

Uncompressed video internally. Whatever compression you like when spitting out in whatever container type (flv/mkv/mp4/...) for external consumption.

Codec copy between container formats has neglegible performance impact.

MaZderMind commented 5 years ago

@computersrmyfriends flv is a very limited format. It can not handle uncompressed Video and only one Audio-Stream with exactly to channels.

A lot of people have vers different needs regarding their final Format(s): SD/HD?, VP8/VP9/h264/h265? mp4/webm/flv? how many and which pair of audio-streams? Maybe multiple variants?

Because of the variety of possible outputs it makes sense to output the most raw format possible out of voctomix and leave the actual scaling, encoding and muxing to an external, user controlled, process.

save CPU usage since I can use "c:v copy c:a copy -f flv" instead of again doing a H.264 conversion from mkv?

The misconception here is that the mkv contains real, uncompressed frames, just as they fall out of the composition pipeline. no encoding is happening inside voctomix, you get the data as raw as possible. For delivery to an end-user that content usually has to undergo compression at least once. What we are discussing is where this (single) compression is happening: in your ffmpeg call.

CarlFK commented 5 years ago

a simple answer: voctocore can't mix flv.

computersrmyfriends commented 5 years ago

Thank you so much @markvdb and @MaZderMind. I really appreciate your patient and detailed explaination. It is very helpful.

Thank you!