Recherche avancée

Médias (91)

Sur d’autres sites (74)

  • Anomalie #2024 (Nouveau) : langue des boutons d’admin

    7 avril 2011, par jluc -

    Sur spip.net, depuis plusieurs années, le texte des boutons d’admin m’apparaît en espagnol alors que tous mes paramétrages (espace perso, navigateur etc) sont en français. Je me souviens qu’un habitué d’IRC constatait également ce même (...)

  • Struggling to add subtitles to a video using FFMPEG and C#

    19 mars, par MattHodson

    I'm trying to add subtitles to my videos, 100% with code using FFMPEG and C#.

    


    But I'm getting the following error :

    


    


    ffmpeg version 2024-02-04-git-7375a6ca7b-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration : —enable-gpl —enable-version3 —enable-static —pkg-config=pkgconf —disable-w32threads —disable-autodetect —enable-fontconfig —enable-iconv —enable-gnutls —enable-libxml2 —enable-gmp —enable-bzlib —enable-lzma —enable-zlib —enable-libsrt —enable-libssh —enable-libzmq —enable-avisynth —enable-sdl2 —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxvid —enable-libaom —enable-libopenjpeg —enable-libvpx —enable-mediafoundation —enable-libass —enable-libfreetype —enable-libfribidi —enable-libharfbuzz —enable-libvidstab —enable-libvmaf —enable-libzimg —enable-amf —enable-cuda-llvm —enable-cuvid —enable-ffnvcodec —enable-nvdec —enable-nvenc —enable-dxva2 —enable-d3d11va —enable-libvpl —enable-libgme —enable-libopenmpt —enable-libopencore-amrwb —enable-libmp3lame —enable-libtheora —enable-libvo-amrwbenc —enable-libgsm —enable-libopencore-amrnb —enable-libopus —enable-libspeex —enable-libvorbis —enable-librubberband
libavutil 58. 36.101 / 58. 36.101
libavcodec 60. 38.100 / 60. 38.100
libavformat 60. 20.100 / 60. 20.100
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 17.100 / 9. 17.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
libpostproc 57. 4.100 / 57. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C :\Users\Gamer\source\repos\XXXX\bin\Debug\net8.0\ce31c8ab-4b53-44e8-9e25-d02ba5466144\output.mp4' :
Metadata :
major_brand : isom
minor_version : 512
compatible_brands : isomiso2avc1mp41
encoder : Lavf60.20.100
Duration : 00:03:18.84, start : 0.000000, bitrate : 101 kb/s
Stream #0:00x1 : Video : h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1024x1792, 26 kb/s, 1 fps, 1 tbr, 16384 tbn (default)
Metadata :
handler_name : VideoHandler
vendor_id : [0][0][0][0]
encoder : Lavc60.38.100 libx264
Stream #0:10x2 : Audio : aac (LC) (mp4a / 0x6134706D), 24000 Hz, mono, fltp, 74 kb/s (default)
Metadata :
handler_name : SoundHandler
vendor_id : [0][0][0][0]
[Parsed_subtitles_0 @ 000001a87404e3c0] Unable to parse option value "UsersGamersourcereposXXXXbinDebugnet8.0ce31c8ab-4b53-44e8-9e25-d02ba5466144output.srt" as image size
Error applying option 'original_size' to filter 'subtitles' : Invalid argument
[vost#0:0/libx264 @ 000001a874064a40] Error initializing a simple filtergraph
Error opening output file C :\Users\Gamer\source\repos\XXXX\bin\Debug\net8.0\ce31c8ab-4b53-44e8-9e25-d02ba5466144\videoWithSubtitles.mp4.
Error opening output files : Invalid argument

    


    


    It seems to be something related to paths, but I have tried EVERYTHING in my knowledge to fix this, still no luck... spent the majority of the day on it, no luck... so StackOverflow here I come !

    


    My code :

    


       public static async Task AddSubtitlesToVideoAsync(string videoPath, string subtitlesPath, string outputPath)
    {
        if (File.Exists(videoPath) && File.Exists(subtitlesPath))
        {
            //string subtitlesPathForwardSlashes = subtitlesPath.Replace("\\", "/");
            //string ffmpegCommand = $"-i \"{videoPath}\" -filter_complex \"subtitles='{subtitlesPathForwardSlashes}'\" \"{outputPath}\"";
            //string ffmpegCommand = $"-i \"{videoPath}\" -vf subtitles={subtitlesPathForwardSlashes} \"{outputPath}\"";
            //string ffmpegCommand = $"-i \"{videoPath}\" -vf subtitles=\"{subtitlesPath}\" \"{outputPath}\"";
            string subtitlesPathEscaped = subtitlesPath.Replace("\\", "\\\\");
            string ffmpegCommand = $"-i \"{videoPath}\" -vf subtitles=\"{subtitlesPathEscaped}\" \"{outputPath}\"";


            //output    -i C:\Users\Gamer\source\repos\XXXX\bin\Debug\net8.0\d745a08d-b932-47ac-a81c-45e9483590a7\output.mp4 -vf subtitles="C:/Users/Gamer/source/repos/XXXX/bin/Debug/net8.0/d745a08d-b932-47ac-a81c-45e9483590a7/generatedSubtitles.srt" C:\Users\Gamer\source\repos\XXXX\bin\Debug\net8.0\d745a08d-b932-47ac-a81c-45e9483590a7\videoWithSubtitles.mp4
            await ExecuteSubtitleCommandAsync(ffmpegCommand);
        }
        else
        {
            Console.WriteLine("Files can't be found.");
        }
    }

    public static async Task ExecuteSubtitleCommandAsync(string arguments)
    {
        string ffmpegExecutablePath = ffmpegRoot;
        var startInfo = new ProcessStartInfo(ffmpegExecutablePath, arguments)
        {
            CreateNoWindow = true,
            UseShellExecute = false,
            RedirectStandardOutput = true,
            RedirectStandardError = true
        };

        using (var process = new Process { StartInfo = startInfo })
        {
            process.EnableRaisingEvents = true; // Enable the Exited event.
            process.Exited += (sender, e) =>
            {
                Console.WriteLine($"FFmpeg process exited with code {process.ExitCode}.");
            };

            try
            {
                process.Start();
                // Asynchronously read the standard output and standard error of the process
                var outputTask = process.StandardOutput.ReadToEndAsync();
                var errorTask = process.StandardError.ReadToEndAsync();
                // Wait for both asynchronous tasks to complete
                await Task.WhenAll(outputTask, errorTask);

                var output = await outputTask;
                var error = await errorTask;

                if (!string.IsNullOrEmpty(error))
                {
                    Console.WriteLine("FFmpeg error: " + error);
                }
                else
                {
                    Console.WriteLine("FFmpeg process completed successfully.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
            }
            finally
            {
                // Wait for the process to exit if it hasn't already.
                if (!process.HasExited)
                {
                    process.WaitForExit();
                }
            }
        }
    }


    


  • webm video - it can not be copy to cut a correct time part for ffmpeg command(without re-encode) [closed]

    15 mars, par DanielHsu

    Command Goal :

    


      

    1. fast copy video's part
    2. 


    3. no re-encode with libvpx
    4. 


    


    Linux command below :
ffmpeg -ss 00:01:00 -to 00:02:00 -i input.webm -c copy output.webm

    


    command's process details :

    


    ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers   built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)   configuration:
--enable-libvpx   libavutil      58. 29.100 / 58. 29.100   libavcodec     60. 31.102 / 60. 31.102   libavformat    60. 16.100 / 60. 16.100   libavdevice    60.  3.100 / 60.  3.100   libavfilter     9. 12.100 / 
9. 12.100   libswscale      7.  5.100 /  7.  5.100   libswresample   4. 12.100 /  4. 12.100 Input #0, matroska,webm, from 'input.webm':   Metadata:
    title           : FFmpeg
    ENCODER         : Lavf58.29.100   Duration: 00:06:04.43, start: 0.000000, bitrate: 2487 kb/s   Stream #0:0: Video: vp8, yuv420p(tv, bt470bg/unknown/unknown, progressive), 1280x720, SAR 1:1 DAR 16:9, 1k tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:06:04.432000000 Output #0, webm, to 'output.webm':   Metadata:
    title           : FFmpeg
    encoder         : Lavf60.16.100   Stream #0:0: Video: vp8, yuv420p(tv, bt470bg/unknown/unknown, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1k tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:06:04.432000000 Stream mapping:   Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [out#0/webm @ 0x5609ee9bb840] video:35912kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.069370% size=   35937kB time=00:00:59.96 bitrate=4909.2kbits/s speed= 211x


    


    command usage's result :
output.webm always start from input.webm's 00:00:00 to end input.webm's 00:01:00
(it should be start from input.webm's 00:01:00 to end input.webm's 00:02:00 )

    


    input.webm format details from mediainfo tool :

    


    


    General Count : 331 Count of stream
of this kind : 1 Kind of stream
    
 : General Kind of stream : General Stream
identifier : 0 Count of video streams
    
 : 1 Video_Format_List : VP8
Video_Format_WithHint_List : VP8 Codecs Video
    
 : VP8 Complete name :
pure_film/65ea641a4075c92236151349_video.webm Folder name
    
 : pure_film File name extension :
65ea641a4075c92236151349_video.webm File name
    
 : 65ea641a4075c92236151349_video File extension
    
 : webm Format : WebM Format
    
 : WebM Format/Url :
http://www.webmproject.org/ Format/Extensions usually used :
webm Commercial name : WebM Format version
    
 : Version 2 Internet media type : video/webm File
size : 113301943 File size
    
 : 108 MiB File size : 108 MiB File size
 : 108 MiB File size : 108 MiB File size
 : 108.1 MiB Duration : 364432 Duration
 : 6 min 4 s Duration : 6 min 4 s 432
ms Duration : 6 min 4 s Duration
    
 : 00:06:04.432 Duration : 00:06:04.432
Overall bit rate : 2487201 Overall bit rate
    
 : 2 487 kb/s Stream size : 4801069 Stream
size : 4.58 MiB (4%) Stream size
    
 : 5 MiB Stream size : 4.6 MiB Stream size
 : 4.58 MiB Stream size : 4.579 MiB Stream
size : 4.58 MiB (4%) Proportion of this
stream : 0.04237 IsStreamable
    
 : Yes Title : FFmpeg Movie name
    
 : FFmpeg File last modification date : UTC 2024-03-08
01:41:47 File last modification date (local) : 2024-03-08
09:41:47 Writing application : Lavf58.29.100
Writing application : Lavf58.29.100 Writing
library : Lavf58.29.100 Writing library
    
 : Lavf58.29.100

    


    Video Count : 377 Count of stream
of this kind : 1 Kind of stream
    
 : Video Kind of stream : Video Stream
identifier : 0 StreamOrder
    
 : 0 ID : 1 ID
    
 : 1 Unique ID : 1 Format
    
 : VP8 Format : VP8 Format/Url
    
 : http://www.webmproject.org/ Commercial name
    
 : VP8 Codec ID : V_VP8 Codec ID/Url
    
 : http://www.webmproject.org/ Duration
    
 : 364432.000000 Duration : 6 min 4 s
Duration : 6 min 4 s 432 ms Duration
    
 : 6 min 4 s Duration : 00:06:04.432
Duration : 00:06:04.432 Bit rate
    
 : 2381808 Bit rate : 2 382 kb/s Width
 : 1280 Width : 1 280 pixels Height
 : 720 Height : 720 pixels Pixel
aspect ratio : 1.000 Display aspect ratio
    
 : 1.778 Display aspect ratio : 16:9 Frame rate
mode : VFR Frame rate mode
    
 : Variable Color space : YUV Compression
mode : Lossy Compression mode
    
 : Lossy Delay : 0 Delay
    
 : 00:00:00.000 Delay, origin : Container
Delay, origin : Container Stream size
    
 : 108500874 Stream size : 103 MiB (96%)
Stream size : 103 MiB Stream size
    
 : 103 MiB Stream size : 103 MiB Stream
size : 103.5 MiB Stream size
    
 : 103 MiB (96%) Proportion of this stream : 0.95763
Default : Yes Default
    
 : Yes Forced : No Forced
    
 : No colour_description_present : Yes
colour_description_present_Source : Container Color range
    
 : Limited colour_range_Source : Container Matrix
coefficients : BT.470 System B/G
matrix_coefficients_Source : Container

    


    


    How to make the output.webm be in correct time range(00:01:00 00:02:00) ????