Search code examples
google-cloud-transcoder

Google transcoder HLS: Internal server error


I'm trying to transcode a simple .mp4 file to HLS format and keep getting an error code 13 'Internal server error' from Google after a few minutes. I'm using the Java SDK. Who can help me find out what I'm doing wrong?

        VideoStream videoStream = VideoStream
            .newBuilder()
            .setH264(
                VideoStream
                    .H264CodecSettings.newBuilder()
                    .setBitrateBps(6000000)
                    .setFrameRate(120) //Output framerate will always match the input framerate
                    .setWidthPixels(width)
                    .setHeightPixels(height)
            )
            .build();

        JobConfig config = JobConfig
            .newBuilder()
            .addInputs(Input.newBuilder().setKey("input0").setUri("gs://putyoururlhere"))
            .setOutput(Output.newBuilder().setUri(output))
            .addElementaryStreams(ElementaryStream.newBuilder().setKey("video_stream0").setVideoStream(videoStream))
            .addMuxStreams(
                MuxStream
                    .newBuilder()
                    .setKey("stream")
                    .setContainer("ts")
                    .setFileName("stream")
                    .addElementaryStreams("video_stream0")
                    .build()
            )
            .addManifests(Manifest.newBuilder().addMuxStreams("stream").setFileName("stream").setType(Manifest.ManifestType.HLS).build())
            .build();

Solution

  • Ok, answering my own question for anyone running into this problem in the future. The problem was in the IAM part. The bucket in which the result had to be written was in another project and the default service account created for the transcoder (which is conveniently hidden from the service accounts page!) has only access to buckets within the same project. So I had to add permissions for this service account to write to the bucket. A more describing error message would have been very helpful.