Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Create a video from JPG without have all pictures at begining with ffmpeg
30 mars, par ChklangI have a game which can create some screenshots, and I want to transform them to mp4 video. So I've the next command:
ffmpeg -framerate 15 -i %06d.png -s hd1080 -vcodec libx264 -r 30 timelapse.mp4
But my game lasts 8h, so, after have auto-compress pictures, I've more than 9To of pictures. So I want to start the ffmpeg process before the end of pictures generation, so I want that ffmpeg wait the next picture to digest it.
How can I do it?
-
How to get webam frames one by one but also compressed ?
29 mars, par VoracI need to grab frames from the webcam of a laptop, transmit them one by one and the receiving side stitch them into a video. I picked
ffmpeg-python
as wrapper of choice and the example from the docs works right away:#!/usr/bin/env python # In this file: reading frames one by one from the webcam. import ffmpeg width = 640 height = 480 reader = ( ffmpeg .input('/dev/video0', s='{}x{}'.format(width, height)) .output('pipe:', format='rawvideo', pix_fmt='yuv420p') .run_async(pipe_stdout=True) ) # This is here only to test the reader. writer = ( ffmpeg .input('pipe:', format='rawvideo', pix_fmt='yuv420p', s='{}x{}'.format(width, height)) .output('/tmp/test.mp4', format='h264', pix_fmt='yuv420p') .overwrite_output() .run_async(pipe_stdin=True) ) while True: chunk = reader.stdout.read(width * height * 1.5) # yuv print(len(chunk)) writer.stdin.write(chunk)
Now for the compression part.
My reading of the docs is that the input to the reader perhaps needs be
rawvideo
but nothing else does. I tried replacingrawvideo
withh264
in my code but that resulted in empty frames. I'm considering a third invocation looking like this but is that really the correct approach?encoder = ( ffmpeg .input('pipe:', format='rawvideo', pix_fmt='yuv420p', s='{}x{}'.format(width, height)) .output('pipe:', format='h264', pix_fmt='yuv420p') .run_async(pipe_stdin=True, pipe_stdout=True)
-
convert a heif file to png/jpg using ffmpeg
28 mars, par Ajitesh SinghThe use case is very straight forward. Imagemagick is able to do the conversion but I want to do it with ffmpeg. Here is the all commands I have tried and all of them gives moov atom not found error.
ffmpeg -i /Users/ajitesh/Downloads/sample1.heif -c:v png -pix_fmt rgb48 /Users/ajitesh/Downloads/sample.png
Output
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f85aa813200] moov atom not found /Users/ajitesh/Downloads/sample1.heif: Invalid data found when processing input
it seems like moov atom is actually not present by trying to extract the location of moov atom using the following command
ffmpeg -v trace -i /Users/ajitesh/Downloads/sample1.heif 2>&1 | grep -e type:\'mdat\' -e type:\'moov\'
Output
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f824c00f000] type:'mdat' parent:'root' sz: 2503083 420 2503495 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f824c00f000] type:'mdat' parent:'root' sz: 2503083 420 2503495
-
Including FFmpeg.framework Into My IOS App
28 mars, par AlpiI'm trying to manually integrate ffmpegkit.framework into my Expo Bare Workflow iOS app (built with React Native + native modules via Xcode) because the ffmpegkit will be deprecated and the binaries will be deleted.
So far
- I've downloaded the latest LTS release of FFmpegkit from here.
- I've created 3 files: FFmpegModule.m , FFmpegModule.swift and SoundBud-Bridging-Header.
- Added the frameworks to my projectDir/ios manually, which shows in my XCode under projectDir/Frameworks
- Added all the frameworks into "Frameworks, Libraries and Embedded Content" and make them "Embed and Sign"
- As Framework Search Path in Project Settings, I've set it to "$(PROJECT_DIR)" and recursive
- In "Build Phases" I've added all the frameworks under "Embed Frameworks",set the destination to "Frameworks" and checked "Code Sign on Copy" to all of them and unchecked "Copy Only When Installing"
- Also under "Link Binary With Libraries" I've added all the frameworks and marked them "Required"
Here are the errors I'm getting:
- The framework is not recognized by Swift (No such module 'ffmpegkit')
- A build cycle error: Cycle inside SoundBud; building could produce unreliable results. Target 'SoundBud' has copy command from '.../Frameworks/ffmpegkit.framework' ...
Below you can see my swift file and the ffmpegkit module file: Swift:
import Foundation import ffmpegkit import React @objc(FFmpegModule) class FFmpegModule: NSObject, RCTBridgeModule { static func moduleName() -> String { return "FFmpegModule" } @objc func runCommand(_ command: String, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { FFmpegKit.executeAsync(command) { session in let returnCode = session?.getReturnCode() resolve(returnCode?.getValue()) } } @objc static func requiresMainQueueSetup() -> Bool { return false } }
and the module:
framework module ffmpegkit { header "AbstractSession.h" header "ArchDetect.h" header "AtomicLong.h" header "Chapter.h" header "FFmpegKit.h" header "FFmpegKitConfig.h" header "FFmpegSession.h" header "FFmpegSessionCompleteCallback.h" header "FFprobeKit.h" header "FFprobeSession.h" header "FFprobeSessionCompleteCallback.h" header "Level.h" header "Log.h" header "LogCallback.h" header "LogRedirectionStrategy.h" header "MediaInformation.h" header "MediaInformationJsonParser.h" header "MediaInformationSession.h" header "MediaInformationSessionCompleteCallback.h" header "Packages.h" header "ReturnCode.h" header "Session.h" header "SessionState.h" header "Statistics.h" header "StatisticsCallback.h" header "StreamInformation.h" header "ffmpegkit_exception.h" export * }
I can provide you with more info if you need it. I've been trying non stop for 7 days and it's driving me crazy. I would appreciate any help greatly
-
How to add info to a video and share it with others in React Native
28 mars, par Sanjay KalalI am looking for a solution in which I can pick a video from the gallery and add info or overlay inside it and then share the video with the added info in react native. I tried using ffmpeg but it is not working properly
I need a proper solution in which I can peak the video, add info to it and share it. I tried ffmpeg but it is not working.