#11333 closed task (invalid)
Incomplete conversion of certain Apple H.265 MOV "hstack"
| Reported by: | gegegegege | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | undetermined |
| Version: | 7.1 | Keywords: | hstack mov hevc |
| Cc: | MasterQuestionable | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
How to reproduce:
ffmpeg version 7.1 built on essentials
internal class Program
{
public static void Main(string[] args)
{
// 定义FFmpeg可执行文件的路径,如果FFmpeg已添加到系统路径,则可以直接使用"ffmpeg"
string ffmpegPath = @"F:\ffmpeg-7.1-essentials_build\bin\ffmpeg.exe";
// 定义输入和输出文件路径
string inputFile = "D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件夹\\IMG_1940_1.MOV";
string outputFile = "D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件夹\\IMG_1940_1UD.mp4";
// 定义FFmpeg命令参数
string arguments = $"-i \"{inputFile}\" -filter_complex \"[0:v:view:0][0:v:view:1]hstack\" -c:v hevc -tag:v hvc1 \"{outputFile}\"";
// 创建一个ProcessStartInfo对象来配置FFmpeg进程
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = ffmpegPath,
Arguments = arguments,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = false
//WindowStyle = ProcessWindowStyle.Maximized,
};
Process process = Process.Start(startInfo);
//process.WaitForExit();
//
// Process.Start(@"F:\ffmpeg-7.1-essentials_build\bin\ffmpeg.exe",
// "-i \"D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件夹\\IMG_1940_1.MOV\" -filter_complex \"[0:v:view:0][0:v:view:1]hstack\" -c:v hevc -tag:v hvc1 \"D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件夹\\IMG_1940_1UD.mp4\"");
//
// 启动FFmpeg进程
/*using (Process process = Process.Start(startInfo))
{
// 读取标准输出和错误流(可选)
string output = process.StandardOutput.ReadToEnd();
string errors = process.StandardError.ReadToEnd();
// 等待FFmpeg进程结束
process.WaitForExit();
// 检查是否有错误发生(可选)
if (!string.IsNullOrEmpty(errors))
{
Console.WriteLine("Errors occurred during conversion:");
Console.WriteLine(errors);
}
else
{
Console.WriteLine("Conversion completed successfully.");
}
}*/
}
}
Change History (7)
comment:1 by , 20 months ago
comment:2 by , 20 months ago
| Keywords: | hstack mov hevc added; c# removed |
|---|---|
| Priority: | critical → normal |
| Summary: | Using c# code to call version 7.1 ffmpeg, the video will stop after converting only a small portion → Incomplete conversion of certain Apple H.265 MOV "hstack" |
| Type: | defect → task |
| Version: | git-master → 7.1 |
͏ C# wrapper calling "ffmpeg.exe"?
͏ Is such an example of Object-Oriented Obfuscation..?
͏ Decipher your input into regular command line and try with "-v debug".
͏ Try removing excessive options to ascertain the minimal one.
comment:3 by , 20 months ago
| Cc: | added |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |
͏ ":" is not ":".
͏ (besides the unusual stream label syntax and invocation)
͏ Interpreted:
͏ ffmpeg -v debug -hide_banner -nostdin -nostats -i "In.mov" -filter_complex "[0:v:view:0][0:v:view:1]hstack" -c:v hevc -tag:v hvc1 "Out.mp4"
comment:4 by , 20 months ago
I tested the situation yesterday: in the command line window, it is possible to transfer sbs video completely. Once using c# to call ffmpeg.exe for conversion, the video can not be converted completely, sometimes converted to 3 seconds and sometimes converted to 5 seconds.
Now that I have added the debug command, here is the printed log when it stops before converting completely.(The video has 771 frames)
[hevc @ 000002a462c8c340] Output frame with POC 0/112. [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.01551 queue head -1 ts N/A [out#0/mp4 @ 000002a462266080] sq: send 0 ts 3.333333 [out#0/mp4 @ 000002a462266080] sq: receive 0 ts 3.333333 queue head -1 ts N/A [hevc @ 000002a462e1e880] Decoded frame with POC 0/116. [hevc @ 000002a462c8c340] Decoded frame with POC 0/114. [hevc @ 000002a462facac0] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: send 1 ts 5.060499 [hevc @ 000002a462facac0] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 1, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.03873 queue head -1 ts N/A [hevc @ 000002a462facac0] Output frame with POC 0/113. [out#0/mp4 @ 000002a462266080] sq: send 0 ts 3.366667 [out#0/mp4 @ 000002a462266080] sq: receive 0 ts 3.366667 queue head -1 ts N/A [hevc @ 000002a462facac0] Decoded frame with POC 0/113. [out#0/mp4 @ 000002a462266080] sq: send 1 ts 5.083719 [hevc @ 000002a46232c680] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.06195 queue head -1 ts N/A [hevc @ 000002a46232c680] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 1, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: send 0 ts 3.4 [hevc @ 000002a46232c680] Output frame with POC 0/114. [out#0/mp4 @ 000002a462266080] sq: receive 0 ts 3.4 queue head -1 ts N/A [hevc @ 000002a46232c680] Decoded frame with POC 0/115. [out#0/mp4 @ 000002a462266080] sq: send 1 ts 5.106939 [hevc @ 000002a4622d8080] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.08517 queue head -1 ts N/A [hevc @ 000002a4622d8080] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 1, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: send 1 ts 5.130159 [hevc @ 000002a4622d8080] Output frame with POC 0/115. [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.10839 queue head -1 ts N/A [out#0/mp4 @ 000002a462266080] sq: send 0 ts 3.433333 [out#0/mp4 @ 000002a462266080] sq: receive 0 ts 3.433333 queue head -1 ts N/A [out#0/mp4 @ 000002a462266080] sq: send 1 ts 5.153379 [hevc @ 000002a462726240] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.13161 queue head -1 ts N/A [hevc @ 000002a462726240] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 1, temporal_id: 0 [out#0/mp4 @ 000002a462266080] sq: send 1 ts 5.176599 [hevc @ 000002a462726240] Output frame with POC 0/116. [out#0/mp4 @ 000002a462266080] sq: receive 1 ts 5.15483 queue head -1 ts N/A [out#0/mp4 @ 000002a462266080] sq: send 0 ts 3.466667 [out#0/mp4 @ 000002a462266080] sq: receive 0 ts 3.466667 queue head -1 ts N/A [hevc @ 000002a4622d8080] Decoded frame with POC 0/120. [hevc @ 000002a462726240] Decoded frame with POC 0/118. Process finished with exit code -532,462,766.
comment:5 by , 19 months ago
͏ Then it feels like something abnormal with the calling wrapper?
͏ And the strange exit code also feels unusual.
͏ Also, does ":" really work..?
͏ (haven't tried; but doubt it, per the typical behavior of various programming interfaces)
comment:6 by , 19 months ago
Instead, the following code can call ffmpeg in c# and convert the full video. I'd like to ask you two more questions. One problem is that the print progress is supposed to be a regular log, not an error log. Why can't I use OutputDataReceived to receive it? The second problem is: how can I use ffmpeg to recognize that a mov file is an Apple space video, because there are other mov files that are not Apple space videos. Thank you very much.
public static void Main(string[] args)
{
string ffmpegPath = @"F:\ffmpeg-7.1-essentials_build\bin\ffmpeg.exe";
string inputFile = "D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件夹\\IMG_1940_1.MOV";
string outputFile = "D:\\gege\\_平面空间视频\\_苹果立体视频\\新建文件夹\\IMG_1940_1UD.mp4";
string arguments =
$"-v debug -hide_banner -nostdin -nostats -i \"{inputFile}\" -filter_complex \"[0:v:view:0][0:v:view:1]hstack\" -c:v hevc -tag:v hvc1 \"{outputFile}\"";
try
{
using (Process myProcess = new Process())
{
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = ffmpegPath;
myProcess.StartInfo.Arguments = arguments;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.Start();
myProcess.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs eventArgs) { Console.WriteLine(eventArgs.Data); };
//myProcess.OutputDataReceived += delegate(object sender, DataReceivedEventArgs eventArgs) { Console.WriteLine(eventArgs.Data); }; //inVain
myProcess.BeginErrorReadLine();
myProcess.WaitForExit();
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
comment:7 by , 19 months ago
͏ No idea what happens with C#'s circumlocution...
͏ ffprobe -hide_banner -threads 0 -show_entries "stream=time_base:format=size" -of "flat=h=0" "${In}"
͏ ; alike shall reflect content details.
͏ (or `ffmpeg -i "${In}"` derived)
͏ Refer also: https://trac.ffmpeg.org/ticket/11005#comment:14



The video is a space video shot by Apple 15promax