Since videos are shot in 16:9 mode, both phones have the same field of view at 1080p resolution, but the Sony Xperia Z2 enjoying a wider one when you go at 2160p.
Keep in mind that both phones are limited to just 5 minutes of 2160p videos, so if you need longer clips you'll have to settle for good old 1080p.
MP4 containers with the AVC codec are the choice, but the Sony Xperia Z2 uses a higher framerate, 55Mbps, than the LG G3, 30Mbps. The two have the same audio bitrate, 156Kbps, and they both sound about the same in terms of fidelity.
In theory, the higher bitrate should give the Xperia Z2 an advantage in terms of fine detail, but the LG G3 videos actually look sharper. The contrast and dynamic range aren't as good, but the LG did get the colors closer to reality.
At 1080p resolution, the bitrates get closer at about 17Mbps for the Xperia Z2 and 20Mbps for the LG G3. Here the LG G3 image also looks better, keeping the same pros and cons from the 2160p samples. By the looks of it, Sony's downsampling isn't as smooth as there are some visible jaggies in diagonal lines. Fine detail like text doesn't looks as good as in the LG video either and the samples are noisier.
Sony Xperia Z2 supports 1080p at 60fps video recording, where actually the quality gets better. The contrast seems better, the noise levels drop to a more reasonable levels. Naturally, the 60fps videos are buttery smooth and there are no visible artefacts. Unfortunately, the LG G3 1080p quality looks slightly better even though it is limited to 30fps capturing.
The two flagships support shooting at 720p @ 120fps. The 120fps mode on the Xperia Z2 is called Time shift since it plays back at normal speed and transitions to slo-mo at a user selected point in the video. The Xperia Z2 also have video HDR modes, but doesn't work on 2160p resolution.
Winner: LG G3. It offered a sharper image in both 2160p and 1080p modes, even if the contrast wasn't quite what we would have liked. The Sony Xperia Z2 videos are pretty good in general but loses the head to head combat at both resolutions.