Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (86)

Sur d’autres sites (15293)

  • The duration of movie file recorded by AVAssetWriter is not correct

    1er mars 2016, par ideawu

    I am recording video files with AVAssetWriter combining with AVCaptureVideoDataOutputSampleBufferDelegate. So I can take control over every frame the camara gives in the method :

    - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection{
       double time = CMTimeGetSeconds(CMSampleBufferGetPresentationTimeStamp(sampleBuffer));
       NSLog(@"%f", time);
       [_videoInput appendSampleBuffer:sampleBuffer];
    }

    So I am so sure how many samples have been written to AVAssetWriter via AVAssetWriterInput, and I know exactly the start time and end time of the samples being written. The duration is calculated by end_time - start_time. Say the duration calculated in the video capture programm is 0.5 second.

    I get the .mov/.mp4 file on disk, inspected with ffmpeg -i, it shows a very different duration.

    ffmpeg -i m003.mp4 2>&1 | grep Dura
     Duration: 00:00:01.37, start: 0.836667, bitrate: 95 kb/s

    The movie file show a duration of 1.37 seconds, which it’s quite different with the EXACT duration 0.5.

    Does any one knows the reason ?

  • Movie from PNGs using FFmpeg and Python - rgb24 vs yuv420p

    7 février 2016, par Eilam G

    I wrote a little Python program to grab a bunch of PNGs and render them into a movie using the FFmpeg command line. The PNGs are read into [X*Y*3] numpy arrays (ignoring the alpha channel), new frames are added via interpolation, and the data is fed into FFmpeg as a pipe and saved as an mp4.

    The files play fine in VLC on Windows, but don’t work in iMovie on a Mac. I think it might have to do with most programs expecting H264 videos to be in the YUV420P color space, which my movies aren’t. I’ve tried changing the ffmpeg command -pix_fmt from rgb24 to yuv420p, but no go.

    Relevant Python code attached below.

    def init_vars(args):
       global log_file, file_names, command, num_int_frames, num_files, silent

       file_names = glob('./*.png')
       num_files = len(file_names)

       if args.log:
           log_file = 'bmmp.log'
       else:
           log_file = os.devnull

       silent = args.silent

       frames_per_second = args.fps
       wanted_movie_length = args.length
       movie_file_name = args.name + '.mp4'

       num_int_frames = round((frames_per_second * wanted_movie_length - 1) / (num_files - 1) - 1)

       if sys.platform == 'win32':
           ffmpeg_bin = 'ffmpeg.exe'
       else:
           ffmpeg_bin = 'ffmpeg'

       command = [ffmpeg_bin,
                  '-y', # (optional) overwrite output file if it exists
                  '-f', 'rawvideo',
                  '-vcodec','rawvideo',
                  '-s', '1280x720', # size of one frame
                  '-pix_fmt', 'rgb24',
                  '-r', str(frames_per_second), # frames per second
                  '-i', '-', # The input comes from a pipe
                  '-an', # Tells FFMPEG not to expect any audio
                  movie_file_name]

    Cheers,
    Eilam

  • Convert TIFF images sequence to lossless movie FFMPEG

    9 janvier 2016, par Rarez

    I would like use a h265 codec(FPS must be equal to 25) to save loseless wideo from sequence of TIFF images. I have a problem with save it. I supose that it is little mistake. I tried many combinactions of commands here is last one :

    ffmpeg -f image2 -r $FRAMERATE -i IMG_%03d.tif -vcodec libx265 -x265-params lossless movie.mp4

    And output :

    [libx265 @ 0x2bcaf40] 4:2:2 and 4:4:4 support is not fully defined for HEVC yet. Set -strict experimental to encode anyway.
    Output #0, mp4, to 'movie.mp4':
       Stream #0:0: Video: hevc, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 25 fps
       Metadata:
         encoder         : Lavc57.20.100 libx265
    Stream mapping:
     Stream #0:0 -> #0:0 (tiff (native) -> hevc (libx265))
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    I will be very glad for any help. Thanks