Dear all,
Now I can record video and mux to mp4 file as well. Beside that I tried to split to many videos with specific duration such as 1 minute or 2 minutes. It’s almost finish, I could playback recording video file on PC size with all of media players but I could not playback with TX2 default media player. Only very first recording video files could playback on TX2.
This’s my encoder setting
ctx->enc = NvVideoEncoder::createVideoEncoder(enc_index_string);
if (ctx->enc == NULL)
ERROR_RETURN("Failed to create video encoder");
if (ctx->enc->setCapturePlaneFormat(V4L2_PIX_FMT_H264, ctx->cam_w,
ctx->cam_h, 4 * 1024 * 1024) < 0)
ERROR_RETURN("Failed to set up ENC capture plane format");
if (ctx->enc->setOutputPlaneFormat(V4L2_PIX_FMT_YUV420M, ctx->cam_w,
ctx->cam_h) < 0)
ERROR_RETURN("Failed to set up ENC output plane format");
if (ctx->enc->setBitrate(ctx->bit_rate) < 0)
ERROR_RETURN("Failed to set up ENC bitrate");
if (ctx->enc->setProfile(V4L2_MPEG_VIDEO_H264_PROFILE_HIGH) < 0)
ERROR_RETURN("Failed to set up ENC profile");
if (ctx->enc->setLevel(V4L2_MPEG_VIDEO_H264_LEVEL_5_0) < 0)
ERROR_RETURN("Failed to set up ENC level");
if (ctx->enc->setRateControlMode(V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) < 0)
ERROR_RETURN("Failed to set up ENC rate control mode");
if (ctx->enc->setIFrameInterval(5) < 0)
ERROR_RETURN("Failed to set up ENC frame interval");
if (ctx->enc->setIDRInterval(5) < 0)
ERROR_RETURN("Failed to set up ENC IDR interval");
if (ctx->enc->setFrameRate(30,1) < 0)
ERROR_RETURN("Failed to set up ENC frame rate");
if (ctx->enc->setInsertSpsPpsAtIdrEnabled(true) < 0)
ERROR_RETURN("Failed to set SpsPps enable");
if (ctx->enc->setHWPresetType(V4L2_ENC_HW_PRESET_ULTRAFAST) < 0)
ERROR_RETURN("Failed to set up ENC HW PRESET ALTRAFAST");
if (ctx->enc->output_plane.setupPlane(V4L2_MEMORY_DMABUF, 10, true, false) < 0)
ERROR_RETURN("Failed to set up ENC output plane");
if (ctx->enc->capture_plane.setupPlane(V4L2_MEMORY_MMAP, 10, true, false) < 0)
ERROR_RETURN("Failed to set up ENC capture plane");
This is very first recording video that could playback on TX2
https://drive.google.com/open?id=1E9s4ieppw0k6Sn9DgSCA7GLOXzmRseor
And recording video that could not playback on TX2
https://drive.google.com/open?id=1h2b3kh2VZHG-aKEQWaoQZ3tCw4yEdMu6
Thanks and Best Regards,
Vu Nguyen