2017-01-01から1ヶ月間の記事一覧

RGB <-> YUV

As I wrote in this post, a video consists of a sequence of frames and a frame consists of pixels. A pixel is represented by color. Color has various forms of its representation, which is called color space. The most popular color space is …

Write a code to edit a video

As I wrote in this post, a image data is usually compressed. You need to decode (uncompressed) it, when you edit a video. Because you cannot access a frame without decoding(uncompress) it. ffmpeg enables you to access a frame easily by tak…

Video Streaming Protocol

In this post, I wrote about video file format and video code. When you want to do live streaming, you need to know video streaming protocols. You can upload a video as a file (flv, mp4 gif). However you cann’t download it after finishing u…

How we can store an image or video digitally

ffmpeg is a well known command line tool that allow you to edit videos. You can edit not only a video file but also a video stream. Probably its main function is to convert video format/codec. There are many video codes and formats. But wh…

Streaming Server Comparison

My colleagues and I made an app that can do live streaming with style-transfer filter. (its repo) last year. I did some research about streaming servers. WOWZA A widely-used commercial streaming server. It’s not free since it’s a commercia…

Java Implementation for enumerating pairings in Round-robin tournament

I made a code to enumerate pairings in Round-robin tournament. nakaly.hatenablog.com And I found better algorithm written in Ruby. nakaly.hatenablog.com I ported it to Java. gist.github.com

Private static field in Java interface

You cann't have a private static field in Java interface even though you use Java8 which you can have default implementation. There is a hack for this. public interface InterfaceContainsPrivateStaticFields { class _PrivateStaticFields { pr…

New DNS record propagation

DNS records are cached within TTL. That's why it takes time to see the change when you update a DNS record. Even if you add a new record in DNS, you may need wait for some time to see the new record. It may be caused by DNS master-slave re…

Lombok @Value with Jackson

You can use lombok @Value annotation with Jackson, since Jackson 2.7 added support for ConstructorProperties. However you need to add @AllArgsConstructor too when you use @Value with @Builder. You can also Use @JsonDeserialize but it's a l…

ThrowingProviders In google/guice

You must have annotatedWith even though the actual classes (BbcFeed.class, CnnFeed.class) are bind to different providers as follows: public static class FeedModule extends AbstractModule { protected void configure() { ThrowingProviderBind…

Is Optional be used for method arguments or fields

It doesn't seem to be recommended. Because Optional is designed for return value according to OpenJDK emails below: Shouldn't Optional be Serializable? Loose ends: Optional java.util.Optional fields

Saving a Java Object into database as JSON

There are some ways to save a object (e.g. Java object) into database. One of the ways is to serialize a object and store it into a text column. We can serialize a object by implementing serializable interface in Java. But it is difficult …

Name resolution in linux

We can resolve a hostname from IP address if we have searchlist in /etc/resolv.conf to define DNS suffix. domain example.com options timeout:1 attempts:4 nameserver xxx.yyy.zzz.aaa search example2.com example3.com By default dig don't use …

App Indexing & App Links & Universal Links

I'm confusing App Indexing & App Links & Universal Links. App Indexing enables you to show app deep links in a google search result. As long as your app has deep links (even though you use custom URL scheme), you can see deep links for the…

ZonedDateTime.toString()

ZonedDateTime.toString() occasionally does not have millisec as follows: gist.github.com ZonedDateTime.toString() uses LocalTime.toString(). And LocalTime.toString() omits trailing zeros. The output will be one of the following ISO-8601 fo…

Google/Guice does not support lifecycle

We sometimes want to do something before destroying an injected object. (such as closing DB connection). However guice does not have lifecycle support (such as @PostConstruct, @PreDestroy) intentionally. An issue for having lifecycle has b…