The formal possibility of carrying out a court-martial and execution would be limited by the fact that the entire military of Japan was being disbanded. But the events described in the documentary are not legal proceedings of this kind. If we ask whether a field execution on the orders of a superior officer was "legal" according to pre-1945 law, we are asking a misleading question. A characteristic of the Japanese wartime government was the extreme autonomy of the military, and the disapplication of normal legal protections or process. While there were courts-martial, and statutes, and prisons, it was also the practice for officers to mete out corporal punishment on their own initiative. War crimes were "justified" according to a legal theory of overriding obedience to superior orders. On paper, the Meiji Constitution guaranteed no punishment without trial according to law; in practice, there was no domestic institution that could allow these rights to be vindicated.
After the war and during the occupation, there were a series of general and special amnesties declared by the government of Japan, with the concurrence of the Supreme Commander for the Allied Powers, General Douglas MacArthur (who had plenary powers by the instrument of surrender made on 2 September 1945). These were in the form of various Imperial Orders, since the Meiji Constitution vested the pardon power in the Emperor. A replacement constitution was not agreed until 1947 and so the previous institutions carried on, under Allied supervision and reform.
A general amnesty declared on 17 October 1945 included the pardon of people who had committed "offences against the preservation of order and discipline within the armed services" and "offences related to the Military Service Law" (i.e. conscription), applicable to pre-surrender offences where the punishment was imprisonment for fewer than two years. Commutation of death sentences, and reduction of penal sentences, were effected by separate decrees. This is described in Central Liaison Office memorandum no. 223 of 12 October. Several other related edicts followed over the next several years, including an act of the final Imperial Diet in 1947.
These decrees generally envisage that the State could punish offences against military discipline even after losing the war. A deserter might not qualify for amnesty, since that was seen as an extremely serious violation, but the point is that wartime offences were still punishable in principle, and had to be expressly forgiven.
Alfred C. Oppler, a German jurist who advised MacArthur, noted a negotiation relating to officers who had continued to fight shortly after the surrender. They had technically "deserted" and were not covered by the general amnesty because they had been deemed to have formed a conspiracy. They were not guilty of offences against the occupation, because it hadn't started yet. The decision was turned over to the Japanese government who extended a special pardon. (January 1947 diary notes in Legal Reform in Occupied Japan: A Participant Looks Back, A. C. Oppler; Princeton, 1976.) In the context of the transition, this example illustrates the continuity of the law of Japan, but also how it was operated in subordination to the Allied power. It also shows that a desertion after the war continued to be punishable in principle.