Hacker News new | past | comments | ask | show | jobs | submit login

I originally wanted to use json for parsing, however the unmarshalling would have required a large struct with fields for all the metadata ffprobe outputs. I thought that using "-print_format compact" resulted in a simpler parsing approach. Correct me if I'm wrong there, I'm still relatively new to Go.

Thanks for sharing the link to your project. I'll try to implement the stdout buffering with "bytes" rather than doing it manually.




You could do non-strict parsing and would be fine. You can also parse it directly into an untyped map.

https://golangbyexample.com/json-to-map-golang/


You don’t need fields for everything that’s printed, you only need to specify fields of interest, the rest are automatically discarded. You can also use alternative json parsers like fastjson that are more dynamic instead of upfront.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: