Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • convert flv video file to m3u8 format with h264 and aac codec in ffmpeg

    27 avril 2017, par user2138489

    I want to convert a flv video file to a m3u8 container using AAC and H264 encoding in FFmpeg version 0.7.15. Can anyone help me on this?

    I used this command to convert to the m3u8 format, but it throws an error:

    cmd: ffmpeg -i sample.flv -b 1104k -s 320x240 -vcodec libx264 -ab 32 -ar 24000 -acodec libfaac final_video.m3u8

    Error:

    ffmpeg version 0.7.15, Copyright (c) 2000-2013 the FFmpeg developers
      built on Feb 22 2013 07:22:31 with gcc 4.4.5
      configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libfreetype --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis
      libavutil    50. 43. 0 / 50. 43. 0
      libavcodec   52.123. 0 / 52.123. 0
      libavformat  52.111. 0 / 52.111. 0
      libavdevice  52.  5. 0 / 52.  5. 0
      libavfilter   1. 80. 0 /  1. 80. 0
      libswscale    0. 14. 1 /  0. 14. 1
      libpostproc  51.  2. 0 / 51.  2. 0
    [libspeex @ 0x93e6c60] Missing Speex header, assuming defaults.
    [flv @ 0x93e25e0] Estimating duration from bitrate, this may be inaccurate
    
    Seems stream 0 codec frame rate differs from container frame rate: 60.00 (60/1) -> 30.00 (60/2)
    Input #0, flv, from 'sample.flv':
      Metadata:
        duration        : 60
        creationdate    : Wed Apr 10 17:13:05
      Duration: 00:01:00.05, start: 0.000000, bitrate: N/A
        Stream #0.0: Video: h264 (Main), yuv420p, 320x240 [PAR 1:1 DAR 4:3], 30 tbr, 1k tbn, 60 tbc
        Stream #0.1: Audio: libspeex, 16000 Hz, 1 channels, s16
    WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s
    [NULL @ 0x93e3840] Unable to find a suitable output format for 'final_video.m3u8'
    final_video.m3u8: Invalid data found when processing input
    
  • FFmpeg concat after overlay's (append)

    27 avril 2017, par Loïc Noest

    I have some video to witch i need to concat a header and add some overlay's, the problem is that i need to do the overlay's first becouse otherwise the time woundn't be correct, and only afterwards concat the header to the begining of the video

    ffmpeg -i talk.mp4  -i start_pancarte.png -i end_pancarte.png  -i logo_alpha.png  -i header.mp4-filter_complex\ 
    " overlay= enable='between(t,0,3.04)' [x];\
    [x] overlay = enable='between(t,495.64, 498.6)' [y];\
    [y] overlay=15:15:enable='between(t,3.04,495.64)'[c];\
    [c] concat " solution.mp4
    

    This obviously adds the header to the end and I need it in the front, how do I do this (in 1 command)?

  • error LNK1120 : unresolved externals

    27 avril 2017, par Sanduni Wickramasinghe

    I am trying to build the following code. But it gives the error as "error LNK1120: 5 unresolved externals". I'm using C++ in Visual Studio 2013. Libraries are included properly. Error comes at avformat_open_input method. I'm using muxing in ffmpeg in my code. Please help.

    const char *url = "H:/Sanduni_projects/ad_2.mp4";
    
    AVFormatContext *s = NULL;
    int ret = avformat_open_input(&s, url, NULL, NULL);
    if (ret < 0)
        abort();
    
    AVDictionary *options = NULL;
    
    av_dict_set(&options, "video_size", "640x480", 0);
    av_dict_set(&options, "pixel_format", "rgb24", 0);
    
    if (avformat_open_input(&s, url, NULL, &options) < 0){
        abort();
    }
    
    av_dict_free(&options);
    
    AVDictionaryEntry *e;
    
    if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
        fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key);
        abort();
    }
    
    avformat_close_input(&s);
    
  • How to convert live video stream to mp4 format stream using FFmpeg API [on hold]

    27 avril 2017, par krish

    Using FFmpeg API :ConvertLiveMediaTask

    ConvertLiveMedia(Stream inputStream, string inputFormat, Stream outputStream, string outputFormat, ConvertSettings settings);

    Requirement : want to convert video file from any format to mp4 format and conversion should happen on fly using ConvertLiveMedia API

    Please help me for this problem, I googled so many times i didnt get a solution for this.

    Here is my code

    const int megabyte = 1024 * 1024;
    
     static string theFilename = @"F:\BackUp\Short video clip-nature.avi";
    
     static string[] VideoExtension = { ".ac3", ".aiff", ".alaw", ".asf", ".ast", ".mp4", ".au", ".avi", ".caf"};
    
     static void Main(string[] args)
     {
         ChunkedData(theFilename, 0);
     }               
    
     private static void ChunkedData(string theFilename, long whereToStartReading = 0)
     {
          string extension = System.IO.Path.GetExtension(theFilename);
    
          Stream chunkStream = new MemoryStream();
    
          if (VideoExtension.Any(Vi => extension.Contains(Vi)))
          {
               FileStream fileStram = new FileStream(theFilename, FileMode.Open, FileAccess.Read);
    
               using (fileStram)
               {
                     byte[] buffer = new byte[megabyte];
    
                     fileStram.Seek(whereToStartReading, SeekOrigin.Begin);
    
                     int bytesRead = fileStram.Read(buffer, 0, megabyte);
    
                     while (bytesRead > 0)
                     {
                         // Here i receive and implement
                         chunkStream = StreamData(buffer, bytesRead, extension);
    
                         bytesRead = fileStram.Read(buffer, 0, megabyte);
                     }
              }
          }                          
     }               
    
     private static Stream StreamData(byte[] buffer, int bytesRead, string formate)
     {
        // Have no idea what to give for ConvertSettings, i simply pass a object
        ConvertSettings settings = new ConvertSettings();
    
        var ffmpeg = new FFMpegConverter();
    
        Stream inputStream = new MemoryStream(buffer);
    
        Stream outputStream = new MemoryStream();
    
        try
        {
           // Here im getting outputStream capacity = 0, length = 0, position =0.
           var task = ffmpeg.ConvertLiveMedia(inputStream, formate, outputStream, Format.mp4, settings );
           task.Start();
    
        }
        catch (Exception ex)
        {
              Console.WriteLine(ex.ToString());
        }
    
        return outputStream; 
    }
    
  • FFMPEG concat video finished but the video missing

    27 avril 2017, par Thien Hoang

    I was concatenated video with FFMPEG. Here is code: ffmpeg -i "concat:video1.webm|video2.webm|video3.webm|video4.webm" -c copy output_video.webm

    After concatenate finished, I play the video but the video display only video1. It missing the video2, video3, video4. Although, The output_video.webm is full size. I don't know why? Please help me, How to fix it?

    Thank you so much, Bien