Quantcast
Channel: MediaSPIP
Viewing all 117701 articles
Browse latest View live

Révision 23119: [Salvatore] [source:spip/ecrire/lang/ spip] Export depuis http://trad.spip.net de...


Merge image with a video with nreco

$
0
0

I have converted an image in to a vedio using following code

NReco.VideoConverter.ConvertSettings setting = new NReco.VideoConverter.ConvertSettings(); setting.SetVideoFrameSize(FrameSizeWidth, FrameSizeHeight); setting.VideoCodec = "libx264"; setting.AudioCodec = "mp3"; setting.CustomInputArgs = " -framerate 1/"+imageDuration; setting.CustomOutputArgs = " -profile:v high -r 30"; FFMpegConv.ConvertMedia(inputFilePath, null, outputFIlePath, null, setting);

And also I have a mp4 video with me which is splited using the follwoing code.

var ffMpegConverter = new FFMpegConverter(); ffMpegConverter.ConvertMedia(SourceFile, Format.mp4, DestinationFile, Format.mp4, new ConvertSettings() { Seek = StartTime, MaxDuration = (EndTime-StartTime), VideoCodec = "libx264", AudioCodec = "mp3", });

I need to concat these two videos. I used the fllowing code for it.Here the SourceVideoList array contains the two videos(Splite and image video)

var ffMpegConverter = new FFMpegConverter(); ffMpegConverter.ConcatMedia(SourceVideoList.ToArray(),OutputFile,null,new ConcatSettings());

But when i try to do it gives and error saying "Cannot find a matching stream for unlabeled input pad 3 on filter Parsed_concat_0". Can some one help me on this

ffmpeg will not load libraries

$
0
0

when I try to use ffmpeg this is the result:

dyld: Library not loaded: /opt/local/lib/libx264.142.dylib Referenced from: /opt/local/bin/ffmpeg Reason: image not found
Trace/BPT trap: 5

I downloaded ffmpeg with homebrew on OSX 10.9 and it says that the most up-to-date version (3.1) is already installed.

I found a similar issue on github, but the suggestion of uninstalling ffmpeg and rebuilding from source throws up the following error: Error: SHA256 mismatch

How do I get ffmpeg to work?

-- github

Android video crop using ffmpeg

$
0
0

I am using https://github.com/WritingMinds/ffmpeg-android-java for cropping a video using this command :

execFFmpegCommand(" -i " + in + " -filter:v " + "crop=" + 240 + ":" + 120 + ":" + 100 + ":" + 100 + " -c:a copy " + out);

where "in" is inputfile and "out" is outputfile.

I went through a lot of same questions and couldn't find required solution for this. I also tried the following command which i found going through the search:

execFFmpegCommand(" -i " + in + " -filter:v " + "crop=" + 240 + ":" + 120 + ":" + 100 + ":" + 100 + " -c:a copy " + out);

The main error that I'm getting here is : Output file #0 does not contain any stream

private void execFFmpegCommand(final String command) { try { ffmpeg.execute(new String[]{command}, new ExecuteBinaryResponseHandler() { @Override public void onFailure(String s) { Log.d(TAG, "FAILED with output : " + s); progressDialog.dismiss(); } @Override public void onSuccess(String s) { Log.d(TAG, "SUCCESS with output : " + s); } @Override public void onProgress(String s) { Log.d(TAG, "Started command : ffmpeg " + command); Log.d(TAG, "progress : " + s); } @Override public void onStart() { Log.d(TAG, "Started command : ffmpeg " + command); progressDialog.show(); } @Override public void onFinish() { Log.d(TAG, "Finished command : ffmpeg " + command); progressDialog.dismiss(); } }); } catch (FFmpegCommandAlreadyRunningException e) { // do nothing for now }
}

The LogCat is :

 D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.209 17283-17866/com.myapp D/FFmpeg: Running publishing updates method
08-12 11:16:03.231 17283-17283/com.myapp W/MediaRecorder: mediarecorder went away with unhandled events
08-12 11:16:03.232 17283-17283/com.myapp W/MediaRecorder: mediarecorder went away with unhandled events
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: progress : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: progress : built with gcc 4.8 (GCC)
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: progress : configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
08-12 11:16:03.355 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libavutil 55. 17.103 / 55. 17.103
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libavcodec 57. 24.102 / 57. 24.102
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libavformat 57. 25.100 / 57. 25.100
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libavdevice 57. 0.101 / 57. 0.101
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libavfilter 6. 31.100 / 6. 31.100
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libswscale 4. 0.100 / 4. 0.100
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libswresample 2. 0.101 / 2. 0.101
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : libpostproc 54. 0.100 / 54. 0.100
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : Output #0, mp4, to ' -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4':
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: Started command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
08-12 11:16:03.356 17283-17283/com.myapp D/ffmpeg: progress : Output file #0 does not contain any stream
08-12 11:16:03.357 17283-17283/com.myapp D/ffmpeg: FAILED with output : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (GCC) configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags= libavutil 55. 17.103 / 55. 17.103 libavcodec 57. 24.102 / 57. 24.102 libavformat 57. 25.100 / 57. 25.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 31.100 / 6. 31.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Output #0, mp4, to ' -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4': Output file #0 does not contain any stream
08-12 11:16:03.370 17283-17283/com.myapp D/ffmpeg: Finished command : ffmpeg -i /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980754658.mp4 -vf crop=240:120:100:100 -c:a copy /storage/emulated/0/Android/data/com.myapp/Files/Video/myapp1470980763106_vid.mp4
-- https://github.com/WritingMinds/ffmpeg-android-java

avconv save 10 frames and update them in cycle

$
0
0

The way I am saving frames from camera is:

avconv -f video4linux2 -i /dev/video0 -r 5 output_%04d.png

Seems to be working fine... but... I need to save only 10 frames and overwrite the saved first saved all the time... any way to do that? I need to be able to save frames and process them in other application... but process may take longer than record.

Tried to save one frame and overwrite it, but the problem is that file is being used and it simply doesn't work.

ffmpeg concatenation after using drawtext filter

$
0
0

I'm fairly new to ffmpeg, but after a few days of searching on this issue, I've completely hit a brick wall. Any help would be appreciated.

My use case: Our client wants to upload videos for multiple regions. Each video will be the same format, 1920x1080, mp4. For each region, they want to add a different image at the end of the video, for a few seconds. This image contains their logo, some additional info, and a variable code. They will enter this code alongside the uploaded video. The image stays the same, so is already present on the server. So basically, I have an input video, a video of an image, and a small code. I need to add this code to the video of the image (in a predefined position), and then I need to add the resulting video to the end of the input video. Once that is complete, I just need to output the video in 1920x1080 and in 1024x576.

I have tried several things, but the concatenation step always fails with the manipulated video's.

Attempt 1

In my first attempt, I used ffmpeg to create a video from an image, and add the text in the designated area.

ffmpeg -y -f lavfi -i image.png -r 30 -t 10 -pix_fmt yuv420p -map 0:v -vf drawtext="fontfile=HelveticaNeue.dfont: text='GLNS/TEST/1234b': fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=7: x=179: y=805" imageVideo.mp4

This command creates a .mp4 video of the correct size, with a duration of 10 seconds, and adds the text 'GLNS/TEST/1234b' in the correct location.

Next, I use the following command to concatenate the two videos. Both have the same resolution and codec.

ffmpeg -f concat -safe 0 -i config.txt -vf scale=1920:1080 outputHD.mp4 -vf scale=1024:576 outputSD.mp4

config.txt contains following:

file my_input_file.mp4
file ImageVideo.mp4

This concatenation works with regular videos. However, when I use it with ImageVideo.mp4 (the one created by the first command) I get this error log:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f86dc924600] Auto-inserting h264_mp4toannexb bitstream filtereed=0.509x [aac @ 0x7f86dc019e00] Number of bands (31) exceeds limit (5).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x7f86dc019e00] Number of bands (27) exceeds limit (8).
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 0x7f86dd857200] Error splitting the input into NAL units.
[h264 @ 0x7f86dd829400] Invalid NAL unit size.
[h264 @ 0x7f86dd829400] Error splitting the input into NAL units.
[aac @ 0x7f86dc019e00] Number of bands (10) exceeds limit (1).
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 0x7f86dd816800] Invalid NAL unit size.
[h264 @ 0x7f86dd816800] Error splitting the input into NAL units.
[aac @ 0x7f86dc019e00] Number of bands (24) exceeds limit (1).
Error while decoding stream #0:1: Invalid data found when processing input #this goes on for a few hundred lines

The resulting output is identical to the input video, but does not contain the desired image video at the end.

Attempt 2

Since the above attempt didn't work, I tried concatenating a video I let our designer make of the image with Adobe After Effects. This video was also saved as a .mp4 with the H264 codec. If I concatenate the input video and this one, I get a correct result. However, as soon as I add the code in the designated area with this command:

ffmpeg -i new_image_video.mp4 -vf drawtext="fontfile=HelveticaNeue.dfont: text='GLNS/TEST/1234b': fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=7: x=179: y=805" -c:v libx264 imageVideo.mp4

I get this error:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff94c800000] Auto-inserting h264_mp4toannexb bitstream filter97x [h264 @ 0x7ff94b053800] top block unavailable for requested intra mode -1
[h264 @ 0x7ff94b053800] error while decoding MB 0 0, bytestream 49526
[h264 @ 0x7ff94b053e00] number of reference frames (1+3) exceeds max (3; probably corrupt input), discarding one
[h264 @ 0x7ff94b053e00] chroma_log2_weight_denom 28 is out of range
[h264 @ 0x7ff94b053e00] illegal long ref in memory management control operation 2
[h264 @ 0x7ff94b053e00] cabac_init_idc 32 overflow
[h264 @ 0x7ff94b053e00] decode_slice_header error
[h264 @ 0x7ff94b053e00] no frame!
[h264 @ 0x7ff94b053800] concealing 8160 DC, 8160 AC, 8160 MV errors in I frame
[h264 @ 0x7ff94b072a00] reference overflow 22 > 15 or 0 > 15
[h264 @ 0x7ff94b072a00] decode_slice_header error
[h264 @ 0x7ff94b072a00] no frame!
[h264 @ 0x7ff94b01a400] illegal modification_of_pic_nums_idc 20
[h264 @ 0x7ff94b01a400] decode_slice_header error
[h264 @ 0x7ff94b01a400] no frame!
[h264 @ 0x7ff94b01aa00] illegal modification_of_pic_nums_idc 20
[h264 @ 0x7ff94b01aa00] decode_slice_header error
[h264 @ 0x7ff94b01aa00] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7ff94b053800] deblocking_filter_idc 8 out of range
[h264 @ 0x7ff94b053800] decode_slice_header error
[h264 @ 0x7ff94b053800] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7ff94b053e00] illegal memory management control operation 8
[h264 @ 0x7ff94b053e00] co located POCs unavailable
[h264 @ 0x7ff94b053e00] error while decoding MB 2 0, bytestream -35
[h264 @ 0x7ff94b053e00] concealing 8160 DC, 8160 AC, 8160 MV errors in B frame
[h264 @ 0x7ff94b072a00] number of reference frames (1+3) exceeds max (3; probably corrupt input), discarding one # this goes on for a while... [h264 @ 0x7ff94b01a400] concealing 4962 DC, 4962 AC, 4962 MV errors in B frame
Error while decoding stream #0:0: Invalid data found when processing input
frame= 2553 fps= 17 q=-1.0 Lsize= 26995kB time=00:01:42.16 bitrate=2164.6kbits/s dup=0 drop=60 speed=0.697x video:25258kB audio:1661kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.285236%
[libx264 @ 0x7ff94b810400] frame I:35 Avg QP:17.45 size: 55070
[libx264 @ 0x7ff94b810400] frame P:711 Avg QP:19.73 size: 18712
[libx264 @ 0x7ff94b810400] frame B:1807 Avg QP:21.53 size: 5884
[libx264 @ 0x7ff94b810400] consecutive B-frames: 3.4% 5.0% 4.9% 86.6%
[libx264 @ 0x7ff94b810400] mb I I16..4: 38.2% 49.3% 12.5%
[libx264 @ 0x7ff94b810400] mb P I16..4: 12.4% 14.0% 1.0% P16..4: 29.6% 4.8% 1.9% 0.0% 0.0% skip:36.2%
[libx264 @ 0x7ff94b810400] mb B I16..4: 1.5% 1.2% 0.1% B16..8: 27.3% 1.6% 0.1% direct: 1.8% skip:66.4% L0:45.8% L1:51.4% BI: 2.8%
[libx264 @ 0x7ff94b810400] 8x8 transform intra:49.5% inter:85.4%
[libx264 @ 0x7ff94b810400] coded y,uvDC,uvAC intra: 21.2% 22.3% 2.5% inter: 4.6% 7.0% 0.0%
[libx264 @ 0x7ff94b810400] i16 v,h,dc,p: 23% 26% 10% 41%
[libx264 @ 0x7ff94b810400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 19% 35% 3% 3% 3% 3% 3% 2%
[libx264 @ 0x7ff94b810400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 20% 16% 5% 7% 6% 5% 5% 4%
[libx264 @ 0x7ff94b810400] i8c dc,h,v,p: 67% 16% 15% 2%
[libx264 @ 0x7ff94b810400] Weighted P-Frames: Y:7.3% UV:4.2%
[libx264 @ 0x7ff94b810400] ref P L0: 66.3% 8.7% 17.9% 7.0% 0.1%
[libx264 @ 0x7ff94b810400] ref B L0: 88.2% 10.1% 1.7%
[libx264 @ 0x7ff94b810400] ref B L1: 94.9% 5.1%
[libx264 @ 0x7ff94b810400] kb/s:2026.12
[aac @ 0x7ff94b072400] Qavg: 635.626

The resulting output is identical to the input video, but does not contain the desired image video at the end.

One thing I have noticed: When I inspect the video files on mac (Get info) they always contain these lines at 'More info':

Dimensions: 1920 x 1080
Codecs: H.264, AAC
Color profile: HD(1-1-1)
Duration: 01:42
Audio channels: 2
Last opened: Today 11:02

However, the video's which pass through the drawtext filter have this:

Dimensions: 1920 x 1080
Codecs: AAC, H.264
Duration: 00:10
Audio channels: 2
Last opened: Today 11:07

As you can see, there is no color profile entry, and the codecs have switched places. I assume this is related to my issue, but I can't seem to find a fix for it.

PS: The application will run in a php environment (Symfony). I noticed the concat command wasn't available in the Symfony bundle for ffmpeg, so I'm using the regular terminal commands. I'll execute these using php.

EDIT Attempt 3

On advise of a coworker, I tried converting the video to .avi and reconverting to .mp4, in the hopes this would lose any corrupted or extra info included by the drawtext filter. This spits out a completely different error.

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f812413da00] Auto-inserting h264_mp4toannexb bitstream filtereed=0.516x [concat @ 0x7f8124009a00] DTS 1569260 < 2551000 out of order
[h264 @ 0x7f8124846800] left block unavailable for requested intra4x4 mode -1
[h264 @ 0x7f8124846800] error while decoding MB 0 0, bytestream 47919
[h264 @ 0x7f8124846800] concealing 8160 DC, 8160 AC, 8160 MV errors in I frame
[aac @ 0x7f8125809a00] Queue input is backward in time
[aac @ 0x7f8125815a00] Queue input is backward in time
[h264 @ 0x7f8124846e00] number of reference frames (1+3) exceeds max (3; probably corrupt input), discarding one
[h264 @ 0x7f8124846e00] chroma_log2_weight_denom 26 is out of range
[h264 @ 0x7f8124846e00] deblocking_filter_idc 32 out of range
[h264 @ 0x7f8124846e00] decode_slice_header error
[h264 @ 0x7f8124846e00] no frame!
[mp4 @ 0x7f8124802200] Non-monotonous DTS in output stream 0:1; previous: 4902912, current: 4505491; changing to 4902913. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8125813000] Non-monotonous DTS in output stream 1:1; previous: 4902912, current: 4505491; changing to 4902913. This may result in incorrect timestamps in the output file.
[h264 @ 0x7f8124803400] reference overflow 20 > 15 or 0 > 15
[h264 @ 0x7f8124803400] decode_slice_header error
[h264 @ 0x7f8124803400] no frame!
[mp4 @ 0x7f8124802200] Non-monotonous DTS in output stream 0:1; previous: 4902913, current: 4506515; changing to 4902914. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8125813000] Non-monotonous DTS in output stream 1:1; previous: 4902913, current: 4506515; changing to 4902914. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8124802200] Non-monotonous DTS in output stream 0:1; previous: 4902914, current: 4507539; changing to 4902915. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8125813000] Non-monotonous DTS in output stream 1:1; previous: 4902914, current: 4507539; changing to 4902915. This may result in incorrect timestamps in the output file. # Again, this continues for quite a while.

How can I create mp4 file with 0 frames in it? [on hold]

$
0
0

I need to create an empty .mp4 file, it needs to have 0 frames in it. How can this be achieved? Any ideas?

edit: I have tried rendering 0 frames video from Adobe After Effects (AE doesnt allow this) and setting duration of output video to 0 with ffmpeg -t 0 (it wont aaply, transcodes the whole length)

purpose: I need to concat a video from 10 small parts. I has to be exactly 10 parts, but some of them should be blank(duration 0), so no glitch will be visible

How to write avi file with OpenCV larger than 2 GB?

$
0
0

I'm using OpenCV with Python, but actually can switch to C++, so if it's matter please answer question considering it.

I'm writing .avi file(joining multiple avi files into one) using

cv2.VideoWriter([filename, fourcc, fps, frameSize[, isColor]]) 

but recently found out that I can't write .avi file larger than 2 GB with it. It even mentioned there: Due to this OpenCV for video containers supports only the avi extension, its first version. A direct limitation of this is that you cannot save a video file larger than 2 GB.

But right now I've got no time to learn new library like ffmpeg, I need to do it very fast.

How can I write this file, using C++ or Python with knowledge of OpenCV, or at least with input part - using

cv::Mat 

as frames

-- Due to this OpenCV for video containers supports only the avi extension, its first version. A direct limitation of this is that you cannot save a video file larger than 2 GB.

Youtube processing stuck at 95%

Any way to assign terminal output to variable with python?

$
0
0

I need to grab the duration of a video file via python as part of a larger script. I know I can use ffmpeg to grab the duration, but I need to be able to save that output as a variable back in python. I thought this would work, but it's giving me a value of 0:

cmd = 'ffmpeg -i %s 2>&1 | grep "Duration" | cut -d \' \' -f 4 | sed s/,//' % ("Video.mov")
duration = os.system(cmd)
print duration

Am I doing the output redirect wrong? Or is there simply no way to pipe the terminal output back into python?

html5 video wont play ANY mp4 encodes on ipad

$
0
0

Im trying to embed a mp4 on a page with the HTML5 video tag. Everything works fine on Desktop but nothing will work on an iPad Version 9.3.4. I have the mime types in an .htaccess file. I've tried various encodes with handbrake, Miro and FFmpeg conversions.

Even sample videos like at w3schools and videojs don't play. The video will play if i actually sync it to the iPad, but nothing works over the web. An older iPad actually plays mp4s through the HTML5 video player. I'm ready to throw this POS iPad through a window.

Has anyone found a way to fix this? Is there ANY encoding that this thing will actually play? Thank you in advance for any help.

-- w3schools, videojs

Prepare for 12_alpha1 Release

Improve webm quality when accelerating video

$
0
0

I have a .webm video that I want to accelerate to timelapse it. My original .webm video is 1280x720 and has a very good quality, but when I accelerate it with FFMPEG the quality is really bad (even when the resolution stays the same). This is the command I'm using:

ffmpeg.exe -i test.webm -c:v libvpx-vp9 -filter:v "setpts = 0.1 * PTS" out.webm -threads 3

If I try the same with a .mp4 video the quality remains the same as the original video, but with .webm it just seems to destroy the video quality. I tried changing the bitrate with -minrate 1M -maxrate 1M -b:v 1M but doesn't improve anything.

This is the video I'm converting.

-- This

fate: add test for compand filter

$
0
0
fate: add test for compand filter Signed-off-by: Michael Niedermayer 
  • [DH] tests/fate/filter-audio.mak
  • [DH] tests/filtergraphs/compand
  • [DH] tests/ref/fate/filter-compand

lavc/screenpresso: Fix 32bit pix_fmt, there is no transparency.

$
0
0
lavc/screenpresso: Fix 32bit pix_fmt, there is no transparency. Fixes a remaining issue of ticket #5025.
  • [DH] libavcodec/screenpresso.c
  • [DH] libavcodec/version.h

lavc/raw: Support QT b64a ARGB64 rawvideo.

$
0
0
lavc/raw: Support QT b64a ARGB64 rawvideo. Decoder based on a patch by v0lt, v0lt rambler ru
Fixes ticket #5657.
  • [DH] libavcodec/raw.c
  • [DH] libavcodec/rawdec.c
  • [DH] libavcodec/rawenc.c
  • [DH] libavcodec/version.h
  • [DH] libavformat/isom.c
  • [DH] libavformat/version.h

PHP-FFMpeg not converting (error with ffmpeg)

$
0
0

I have installed ffmpeg server side with all the dependencies, updated it. And then installed PHP-FFMpeg with Composer. Tested that ffmpeg is instaled with a ssh conexion.

root@host [/opt/ffmpeg]# ffmpeg
ffmpeg version N-81322-ge8b355a Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --disable-yasm
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 51.100 / 57. 51.100
libavformat 57. 46.100 / 57. 46.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 51.100 / 6. 51.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg'

But when I try to convert a video file with a php script it throws me a very long error. PHP Code:

open($_SERVER['DOCUMENT_ROOT'].'/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.wmv');
$video ->filters() ->synchronize();
$format = new FFMpeg\Format\Video\X264();
$format->on('progress', function ($video, $format, $percentage) { echo "$percentage % transcoded";});
$video ->save($format,$_SERVER['DOCUMENT_ROOT'].'/resources/uploads/96048/ffd3c5e349fa5745159deef163b5c253.mp4');
?>

Error displayed:

Fatal error: Uncaught exception 'Alchemy\BinaryDriver\Exception\ExecutionFailureException' with message 'ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-y' '-i' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.wmv' '-async' '1' '-metadata:s:v:0' 'start_time=0' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes57ad320a1b685j794u/pass-57ad320a1b716' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.mp4'' in /home/user/working/vendors/install/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:100↵Stack trace:↵#0 /home/user/working/vendors/install/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php(72): Alchemy\BinaryDriver\ProcessRunner->doExecutionFailure(''/usr/bin/ffmpe...')↵#1 / in /home/user/working/vendors/install/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php on line 168
↵"

Then I have took the basic code displayed upwards and ran it directly through ssh.

'/usr/local/bin/ffmpeg' '-y' '-i' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.wmv' '-async' '1' '-metadata:s:v:0' 'start_time=0' '-threads' '12' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes57ad320a1b685j794u/pass-57ad320a1b716' '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.mp4'

And this is the response I get:

ffmpeg version N-81322-ge8b355a Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17) configuration: --disable-yasm libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 51.100 / 57. 51.100 libavformat 57. 46.100 / 57. 46.100 libavdevice 57. 0.102 / 57. 0.102 libavfilter 6. 51.100 / 6. 51.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from '/home/user/working/resources/uploads/23097/2efeb41a1a7085a1dbd469c4895ac23e.wmv': Metadata: SfOriginalFPS : 299700 WMFSDKVersion : 11.0.6001.7000 WMFSDKNeeded : 0.0.0.0000 comment : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball title : Wildlife in HD copyright : © 2008 Microsoft Corporation IsVBR : 0 DeviceConformanceTemplate: AP@L3 Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 192 kb/s Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x720, 5942 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc
Unknown encoder 'libx264'

My question is what to do next? I have wasted 3 days to make this work and this is the furthest I have come. How can I test if libx264 is installed corectly? And if it is not installed corectly how cand I reinstal or make it work?

ffmpeg nvenc encode too slow

$
0
0

i use ffmpeg 3.1 compile with nvenc,when i run the ffmpeg encode example like this:

#include  #include 
#include 
#include 
#include 
#include 
#include 
#include 
#include  #define INBUF_SIZE 4096
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096 /* * Video encoding example */
static void video_encode_example(const char *filename, const char* codec_name)
{ AVCodec *codec; AVCodecContext *c= NULL; int i, ret, x, y, got_output; ACE_INT64 nstart,nend; FILE *f; AVFrame *frame; AVPacket pkt; uint8_t endcode[] = { 0, 0, 1, 0xb7 }; printf("Encode video file %s\n", filename); /* find the video encoder */ codec = avcodec_find_encoder_by_name(codec_name); if (!codec) { fprintf(stderr, "Codec not found\n"); exit(1); } c = avcodec_alloc_context3(codec); if (!c) { fprintf(stderr, "Could not allocate video codec context\n"); exit(1); } /* put sample parameters */ c->bit_rate = 400000; /* resolution must be a multiple of two */ c->width = 352; c->height = 288; /* frames per second */ c->time_base = (AVRational){1,25}; /* emit one intra frame every ten frames * check frame pict_type before passing frame * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I * then gop_size is ignored and the output of encoder * will always be I frame irrespective to gop_size */ c->gop_size = 25; c->max_b_frames = 0; c->thread_count = 1; c->refs = 4; c->pix_fmt = AV_PIX_FMT_YUV420P; if(!strcmp(codec_name,"libx264") { av_opt_set(c->priv_data, "preset", "superfast", 0); av_opt_set(c->priv_data, "tune", "zerolatency", 0); } if(!strcmp(codec_name,"h264_nvenc") { av_opt_set(m_pEncodeCtx->priv_data, "gpu","any",0); av_opt_set(m_pEncodeCtx->priv_data, "preset", "llhp", 0); av_opt_set(m_pEncodeCtx->priv_data,"profile","main",0); m_pEncodeCtx->refs = 0; m_pEncodeCtx->flags = 0; m_pEncodeCtx->qmax = 31; m_pEncodeCtx->qmin = 2; } /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "Could not open codec\n"); exit(1); } f = fopen(filename, "wb"); if (!f) { fprintf(stderr, "Could not open %s\n", filename); exit(1); } frame = av_frame_alloc(); if (!frame) { fprintf(stderr, "Could not allocate video frame\n"); exit(1); } frame->format = c->pix_fmt; frame->width = c->width; frame->height = c->height; /* the image can be allocated by any means and av_image_alloc() is * just the most convenient way if av_malloc() is to be used */ ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, c->pix_fmt, 32); if (ret < 0) { fprintf(stderr, "Could not allocate raw picture buffer\n"); exit(1); } /* encode 1 second of video */ for (i = 0; i < 25; i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for (y = 0; y < c->height; y++) { for (x = 0; x < c->width; x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for (y = 0; y < c->height/2; y++) { for (x = 0; x < c->width/2; x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ nstart = ACE_OS::gettimeofday().get_msec(); ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("%s take time:%d\n",codec_name,ACE_OS::gettimeofday().get_msec()-nstart); printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_packet_unref(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_packet_unref(&pkt); } } /* add sequence end code to have a real MPEG file */ fwrite(endcode, 1, sizeof(endcode), f); fclose(f); avcodec_close(c); av_free(c); av_freep(&frame->data[0]); av_frame_free(&frame); printf("\n");
} int main(int argc, char **argv)
{ const char *output_type; /* register all the codecs */ avcodec_register_all(); video_encode_example("test.h264", "h264_nvenc"); return 0;
}

it encode one frame to a packet about 1800ms,this is too slow. I use Nvidia Grid K1.Is there some parameter error? Thanke you very much

avfilter/vf_signalstats: measure video bitdepth

$
0
0
avfilter/vf_signalstats: measure video bitdepth
  • [DH] doc/filters.texi
  • [DH] libavfilter/vf_signalstats.c

Révision 23120: [Salvatore] [source:spip/ecrire/lang/ spip] Export depuis http://trad.spip.net de...

Viewing all 117701 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>