Open iamarohan opened 4 months ago
The culprit here is the audio track. The audio capture has got in first and written data before the first video frame has been sent so the start pts of the file is first audio frame.
Hi, Thanks for the response. We were busy fixing other issues in our app, so I couldn't get back to you.
I understand the issue. Does this mean that audio capture should be somehow instantiated after I start capturing?
Unity Version
2022.03.11f
AVPro Movie Capture Version
5.2.1 - ultra
Which platform(s) are you using?
iOS, Android
Which OS version(s) are you using?
Android 13, iOS 16.7.5
Which rendering API(s) are you using?
Metal, OpenGLES
Hardware
Galaxy s21 +, various iphone devices (iPhone8, iPhone 12)
Which capture component are you using?
Capture From Camera
Capture mode
Offline
Which output mode are you using?
Video file
Video codecs
H264
Audio source
Unity
Audio codecs
AAC
Any other component configuration
No response
The issue
Hi, I found out that when capturing the video the exact presentation timestamp of the video is not set to the first frame of the video. Currently I am resolving this issue by running an ffmpeg command
ffmpeg -i {realVideoPath} -vf \"setpts=PTS-STARTPTS\" -c:v mpeg4 -crf 16 -preset medium -b:v 10000k -af \"asetpts=PTS-STARTPTS\" -c:a aac -b:a 192k -ar 48000 -r 60 {tempVideoPath}
which corrects the timestamp. However, if I do not do this processing the first frame of the video shows a black screen with no recording. Happens both in iOS and Android
![image](https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/assets/43956286/33f648c1-b3eb-4729-8d36-a1014ee9e1e3)
### Log output
```shell 2024-03-01 14:10:25.928 30023 30356 Info Unity [AVProMovieCapture] Start File Capture: 888x1580 @ F2fps [RGBA32] vcodec:'H264' audio source:'Unity' 48000hz 2 channels acodec:'AAC' to file: '/storage/emulated/0/Android/data/com.lenged.Chelly/files/Captures/ChellyProject_2024-03-01_14-10-25_888x1580.mp4' 2024-03-01 14:10:25.928 30023 30356 Info Unity RenderHeads.Media.AVProMovieCapture.CaptureBase:PrepareCapture() 2024-03-01 14:10:25.928 30023 30356 Info Unity RenderHeads.Media.AVProMovieCapture.CaptureFromCamera:PrepareCapture() 2024-03-01 14:10:25.928 30023 30356 Info Unity WorldVideoRecorderManager:StartRecording() 2024-03-01 14:10:25.928 30023 30356 Info Unity