Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • ffmpeg Using -movflags faststart

    16 mai 2019, par user3571514

    I tried to use the command -movflags faststart

    And got the following error:

    Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved.

    C:\uploads\1\videos>ffmpeg -i simple1.mp4 -codec copy -map 0 -movflags faststart output.mp4

    -movflags faststart output.mp4 ffmpeg version N-34549-g13b7781, Copyright (c) 2000-2011 the FFmpeg developers built on Nov 6 2011 22:02:08 with gcc 4.6.1 configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger - -enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable- libxvid --enable-zlib libavutil 51. 24. 0 / 51. 24. 0 libavcodec 53. 28. 0 / 53. 28. 0 libavformat 53. 19. 0 / 53. 19. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 47. 0 / 2. 47. 0 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'simple1.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.29.104 Duration: 00:02:32.81, start: 0.000000, bitrate: 1166 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 854x480 [ SAR 1:1 DAR 427:240], 1064 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, s16, 93 kb /s Metadata: handler_name : [mp4 muxer @ 04179D00] [Eval @ 0027DAB8] Undefined constant or missing '(' in 'f aststart'

    [mp4 muxer @ 04179D00] Unable to parse option value "faststart"

    [mp4 muxer @ 04179D00] Error setting option movflags to value faststart.

    Output #0, mp4, to 'output.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.29.104 Stream #0:0(und): Video: h264, yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=2-3 1, 1064 kb/s, 29.97 fps, 90k tbn, 29.97 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac, 44100 Hz, mono, 93 kb/s Metadata: handler_name : Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy)

    Could not write header for output file #0 (incorrect codec parameters ?)

  • Set delay when create gif from pictures with FFMPEG + Transparent pictures + Organization

    16 mai 2019, par Hobyrr

    I'm trying to create a GIF from pictures, then I've three questions.

    Actually, this command works fine :

    -framerate 2 -i /data/data/com.example.apptest_ffmpeg_24/pic/%03d.jpg /data/data/com.example.apptest_ffmpeg_24/files/out3.gif
    

    But, i want to set a real delay between each picture, not make a random frame rate, is there any solution ?

    Well, i tried to add pictures with transparent background, but they just weren't add to the GIF, like they don't exist. Any solution?

    Last question ! To create a GIF, i have to add all pictures in the same folder, with a regex names ( here %03d.jpg : 001.jpg, 002.jpg, etc...). Is there any solution to just pass a list of pictures in the command?

    Thank you for your help!

  • ffmpeg concat of mp4s jumps and pauses a few seconds on the joins

    16 mai 2019, par callunaballuna

    I am using ffmpeg to create chunks of 10 second mp4(h265) video. I am using image2pipe as this seems to have a less of an impact on the cpu, the command line is:

    -y -threads 1 -framerate " & FrameRate & " -f image2pipe -i pipe:.jpg -vf format=yuv420p -c:v libx265 -preset ultrafast -crf 28 -vsync vfr " & strSaveDirectory

    I am then concatanating these video chunks using:

    "-f concat -safe 0 -i " & strConcatAVIs & " -c copy " & outPutPath

    If I play each of the 10 second mp4s they appear to be complete but when they are merged to one file sometimes there will be a pause on a join of a few seconds and sometimes the video will jump 3 or 4 seconds on a join.

    Typically this is the descrtiption of a couple of files:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Temp\testmp4\video_1_1_2_2019_5_13_13_15_10.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2mp41
        encoder         : Lavf58.20.100
      Duration: 00:00:09.85, start: 0.000000, bitrate: 225 kb/s
        Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 768x576 [SAR 1:1 DAR 4:3], 221 kb/s, 13 fps, 13 tbr, 13312 tbn, 13 tbc (default)
        Metadata:
          handler_name    : VideoHandler
    -----------------------------------------------
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Temp\testmp4\video_1_1_2_2019_5_13_13_15_20.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2mp41
        encoder         : Lavf58.20.100
      Duration: 00:00:10.00, start: 0.000000, bitrate: 334 kb/s
        Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 768x576 [SAR 1:1 DAR 4:3], 330 kb/s, 13 fps, 13 tbr, 13312 tbn, 13 tbc (default)
        Metadata:
          handler_name    : VideoHandler
    

    At least one output file must be specified

    In my file 'strConcatAVIs' I have tried adding the correct duration which doesn't change much but if I change the duration to be 14, 6 as oppose to 10, 10, which are the correct durations, on the joins that are pausing and speeding up it plays pretty smoothly.

  • How to embed pic_timing SEI wall clock timecodes in RTMP streaming ?

    16 mai 2019, par MorenoGentili

    I need to stream my desktop to the AWS MediaLive service and, as a requirement, I must include wallclock timecodes in the stream. The AWS support kindly informed me that for h.264 encoded streams, I need to provide timecodes as "pic_timing SEI messages".

    I'm streaming with Ffmpeg via the RTMP protocol on Windows 10 so, I tried adding the use_wallclock_as_timestamps and copyts flags to my command.

    ffmpeg -f gdigrab -framerate 30 -offset_x 0 -offset_y 0 -video_size 1920x1080 -show_region 1 -use_wallclock_as_timestamps 1 -i desktop -vf scale=320:240 -c:v libx264 -c:a aac -profile:v main -level 3.1 -pix_fmt yuv420p -copyts -f flv rtmp://:1935//
    

    However, the timecodes are not picked up by AWS MediaLive.

    My questions are:

    • Does the use_wallclock_as_timestamps flag actually create timecodes as "pic_timing SEI messages" as required?
    • If not, how do I add wallclock timecodes as "pic_timing SEI messages"? It doesn't have to be every frame. Every 2 or 3 seconds would suffice.

    I'm stumped. I couldn't find the answer in the Ffmpeg documentation.

    Thanks for your help.

  • How to decrypt hls video content

    16 mai 2019, par SHAH MD MONIRUL ISLAM

    My requirement is to play the encrypted hls video files from local storage in android. I have used NanoHTTPD to create and run the local server. From there I am serving the .ts an .m3u8 files. To play this video ExoPlayer need a key to decrypt the files and thus I made a url: http://localhost:4990/dataKey.

    Here is my local server class:

    import android.os.Environment;
    import android.util.Log;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.Map;
    
    import fi.iki.elonen.NanoHTTPD;
    
    public class LocalStreamingServer extends NanoHTTPD{
        public LocalStreamingServer(int port){
            super(port);
    
        }
    
        @Override
        public Response serve(IHTTPSession session){
            Log.e("req", session.getUri());
    
            if(session.getUri().equalsIgnoreCase("/dataKey")){
    
                return newFixedLengthResponse(Response.Status.OK, "txt", "what is the key?");
            }
    
            if(session.getUri().contains("m3u8")){
                String path = Environment.getExternalStorageDirectory().toString() + "/s3" + session.getUri();
    
                FileInputStream fis = null;
                File f = new File(path);
                try {
                    fis = new FileInputStream(f);
                } catch (FileNotFoundException e) {
                }
                return newFixedLengthResponse(Response.Status.OK, "m3u8", fis, f.length());
            }
    
            if(session.getUri().endsWith("ts")){
                String path = Environment.getExternalStorageDirectory().toString() + "/s3" + session.getUri();
    
                FileInputStream fis = null;
                File f = new File(path);
                try {
                    fis = new FileInputStream(f);
                } catch (FileNotFoundException e) {
    
                }
                return newFixedLengthResponse(Response.Status.OK, "ts", fis, f.length());
            }
    
            String path = Environment.getExternalStorageDirectory().toString() + "/s3/master.m3u8";
    
            FileInputStream fis = null;
            File f = new File(path);
            try {
                fis = new FileInputStream(f);
            } catch (FileNotFoundException e) {
            }
            return newFixedLengthResponse(Response.Status.OK, "m3u8", fis, f.length());
        }
    }
    

    I have transcoded the video using ffmpeg. I need to know that which data or key need to be returned when the dataKey url is called. I have the encrypted the video using these key:

    key=617D8A125A284DF48E3C6B1866348A3F
    IV=5ff82ce11c7e73dcdf7e73cacd0ef98
    

    I can not understand which of them are need to be returned from the datakey url. Both of them are not working. Exoplayer is sending the error message:java.security.InvalidKeyException: Unsupported key size

    can Any one help me about this?