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

FFmpeg - Change resolution of the video with aspect ratio

$
0
0

all.

How to change resolution of the video with aspect ratio with FFmpeg?

There are options http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html

 -s size Set frame size. The format is wxh (ffserver default = 160x128, ffmpeg default = same as source). The following abbreviations are recognized:

and

 -aspect aspect Set the video display aspect ratio specified by aspect. aspect can be a floating point number string, or a string of the form num:den, where num and den are the numerator and denominator of the aspect ratio. For example "4:3", "16:9", "1.3333", and "1.7777" are valid argument values.

For example, I have two input videos:

  • with 200*400 resolution
  • with 400*700 resolution

I need to make output video with 100*200 resolution.

If I will run ffmpeg with -s 100x200, then second video will have bad aspect ratio.

How can I limit output video by width, with auto aspect ratio by height?

For example, I want specify for the output video only width 100px and ffmpeg must automatically calculate height with right aspect ratio.

For first video it will be:

200/100=2

400/2=200

Ie 100x200

For second video it will be:

400/100=4

700/4=75

Ie 100x75

Is it possible?

-- http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html

Anomalie #3815: sql_updateq qui ne fait pas de jointure

$
0
0

Donc, ce que tu veux dire, c'est qu'il n'est pas possible de faire ce type de requête avec l'API de SPIP ?
UPDATE spip_mots as mots, spip_groupes_mots as groupes SET mots.type=groupes.titre WHERE mots.id_groupe=groupes.id_groupe

Cette requête MySQL est pourtant "commune".
Bien entendu, on peut lancer cette requête avec la fonction sql_query()

Anomalie #3815: sql_updateq qui ne fait pas de jointure

$
0
0

Donc, ce que tu veux dire, c'est qu'il n'est pas possible de faire ce type de requête avec l'API de SPIP ?

D'après la doc de l'API il semble bien que non.

LIVE555 how to use h264 framer class to get nal units for ffmpeg

$
0
0

I'm trying to create a small app which will save frames from inoming h264 stream. I took a testRTSP programm as example and made several changes in DummySink::afterGettingFrame function to decode frames with the help of ffmpeg library. As I understand from frameSize, my first two frames are SPS units, so I concatenate them with my third frame and then send new big frame to ffmpeg decoder. But that doesnt work. ffmpeg tells me that my first frame is too big for SPS and then it tells me that there is no frame... I dont know what I need to change here.

void DummySink::afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes,
struct timeval presentationTime, unsigned /*durationInMicroseconds*/)
{
u_int8_t start_code[4] = { 0x00, 0x00, 0x00, 0x01 };
int stCodeLen = 4; if (frameSize == 50)
{ //add start code memcpy(bufferWithStartCode, start_code, stCodeLen); shiftPtr += stCodeLen; memcpy(bufferWithStartCode + shiftPtr, fReceiveBuffer, frameSize); shiftPtr += frameSize;
}
else if (frameSize == 4)
{ memcpy(bufferWithStartCode + shiftPtr, fReceiveBuffer, frameSize); shiftPtr += frameSize;
}
else
{ if (shiftPtr == 0) { memcpy(bufferWithStartCode, start_code, stCodeLen); shiftPtr += stCodeLen; } memcpy(bufferWithStartCode + shiftPtr, fReceiveBuffer, frameSize); avpkt.size = frameSize + shiftPtr; avpkt.data = bufferWithStartCode; shiftPtr = 0; if (!avcodec_send_packet(cContext, &avpkt)) { envir() <<"error sending to decoder"; } if (!avcodec_receive_frame(cContext, picture)) { envir() <<"error rx from decoder"; } if (picture) { FILE *f; char buffer[32]; // The filename buffer. snprintf(buffer, sizeof(char) * 32, "file%i.txt", frame_num); f = fopen(buffer, "w"); fprintf(f, "P5\n%d %d\n%d\n", fSubsession.videoWidth(), fSubsession.videoHeight(), 255); for (int i = 0;i < fSubsession.videoHeight();i++) fwrite(picture->data[0] + i * (picture->linesize[0]), 1, fSubsession.videoWidth(), f); fclose(f); }
} envir() << frameSize <<"\n"; frame_num++; // Then continue, to request the next frame of data:
continuePlaying();

How to get Live video stream from Epiphan to VLC player?

$
0
0

Is there any way to get the live stream from the Epiphan device using Epiphan SDK to play the same in VLC or ffplay?

Using EPIPHAN SDK, I am able to grab the frames and also their SDK provides a way to convert the frames to GUI but i am not able to find a way to get the live stream of video.

Does ffmpeg lib provide a way to do so?

ffmpeg YUV420 to RGB24 converts only one row

$
0
0

I'm trying to convert my YUV420p image to RGB24 in c++ and create bitmap from byte array in c#.

My image size is 1920 w * 1020 h and ffmpeg decoder give me 3 planars for data with linesizes = {1920, 960, 960}. But after sws_scale I'm getting RGB picture with only one plane with linesize = 5760. It does not looks correct: I should get (5760 * h), not just only one row of data. What I'm doing wrong?

 //c++ part if (avcodec_receive_frame(m_decoderContext, pFrame) == 0) { //RGB sws_ctx = sws_getContext(m_decoderContext->width, m_decoderContext->height, m_decoderContext->pix_fmt, m_decoderContext->width, m_decoderContext->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL ); sws_scale(sws_ctx, (uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pFrame->height, pFrameRGB->data, pFrameRGB->linesize); //c# part (im reading data from pipe and its equal to c++ part)------------------------------------------------------------------ byte[] rgbch = new byte[frameLen]; for (int i=0; i 0) { var arrayHandle = System.Runtime.InteropServices.GCHandle.Alloc(rgbch, System.Runtime.InteropServices.GCHandleType.Pinned); var bmp = new Bitmap(1920, 1080, 3, System.Drawing.Imaging.PixelFormat.Format24bppRgb, arrayHandle.AddrOfPinnedObject() ); pictureBox1.Image = bmp; }

Anomalie #3816 (Nouveau): Compatiblité avec PHP 7.0.9 et 5.6.24 et les fonctions "expected to be ...

$
0
0

Suite àhttp://forum.spip.net/fr_264848.html#forum264908

Apparemment SPIP et PHP 7.0.9 génère une page blanche.

D'après Tatu, il faudrait modifier le paramètre de la fonction f_queue() à la ligne 246 du fichier "spip/ecrire/inc/pipelines.php"

Ainsi la fonction :
function f_queue(&$texte)
Devient :
function f_queue($texte)

D'après Luc, cela pourrait venir de https://bugs.php.net/bug.php?id=72698

Si c'est le cas, il faudrait faire une revue du code et chercher les appels de type &$

Anomalie #3816: Compatiblité avec PHP 7.0.9 et 5.6.24 et les fonctions "expected to be a referenc...

$
0
0

De ce que j'ai pu lire dans le forum du ticket PHP, le bug en question a été retiré de PHP 7.0.9, mais il sera de retour avec PHP 7.1 :

In the interest of backwards compatibility I've reverted the commit from PHP-7.0: https://github.com/php/php-src/commit/3b48c5a36f7f903ecf206ff5c46a125f7edfee49
Additionally, I've added an UPGRADING note for PHP-7.1: https://github.com/php/php-src/commit/1315a3dd620926ba1f57eccb3081ab7c64d7a31f

Cela n'empêche en rien de nous prémunir de celui-ci et de corriger dès que possible ;)


ffprobe or avprobe not found. Please install one

$
0
0

i want to add tags to mp3 converted by youtube-dl & ffmpeg :

youtube-dl -o '/Output/qpgTC9MDx1o.mp3' qpgTC9MDx1o -f bestaudio --extract-audio --metadata-from-title "%(artist)s - %(title)s" 2>&1

i have this error in output result :

[youtube] qpgTC9MDx1o: Downloading webpage [youtube] qpgTC9MDx1o: Extracting video information [youtube] qpgTC9MDx1o: Downloading js player en_US-vfluGO3jj [youtube] qpgTC9MDx1o: Downloading DASH manifest [download] /var/www/vhosts/mp3-y.com/httpdocs/Mp3_Output/quick-mp3.com-JALAL-EL-HAMDAOUI-2007-ARRASSIATES-VOL2-F1P-9CDoxlQ.mp3 has already been downloaded [download] 100% of 13.43MiB WARNING: qpgTC9MDx1o: writing DASH m4a. Only some players support this container. Install ffmpeg or avconv to fix this automatically. [fromtitle] parsed artist: Maroon 5 [fromtitle] parsed title: Animals ERROR: ffprobe or avprobe not found. Please install one.

HTML5 video not playing properly in Firefox browser on OS X

$
0
0

The issue:

I recently made a video that I would like to embed in my website as html5 video. I have the video in .mp4 and .ogv format. Here is a test page that I have set up with the video:

http://www.briancjenkins.com/video_test/

Here is the relevant html code that I used to embed the video:

The video plays perfectly on Safari (iOS and OS X), Chrome (OS X), and Firefox (iOS).

However, the video does not play properly in Firefox on OS X. On both my desktop and laptop, when I play the video, the time bar moves, but there is no video. However, if I copy and paste the video URL into the Firefox address bar, the video plays fine. Here a the direct link to the .ogv-format video:

http://www.briancjenkins.com/video_test/US_Inflation_Unemployment_Monthly_BP_Filtered.ogv

I would like to know why the video is not playing in Firefox on OS X and how to fix the problem.

What I know about the issue:

I know that plenty of people have had trouble with html5 video and Firefox. And I also know from reading other questions that in some cases, the server is sending an incorrect mime type. I ran:

$ curl -I http://www.briancjenkins.com/video_test/US_Inflation_Unemployment_Monthly_BP_Filtered.ogv

and found that this does not seem to be the case here:

Server: GitHub.com
Content-Type: video/ogg

which isn't too surprising since Firefox will play the video hosted by Github, just not when its embedded in a webpage. Note that I also tried converting to .webm as an alternative to .ogv but that didn't solve the issue.

About the video

The video was created in Python and and Matplotlib. I used Matplotlib to save the video to .mp4 and then I used ffmpeg to convert the video to .ogv format. Here is the ffmpeg command I used:

$ ffmpeg -i US_Inflation_Unemployment_Monthly_BP_Filtered.mp4 -acodec libvorbis -ac 2 -ab 128k -ar 44100 -b:v 1800k US_Inflation_Unemployment_Monthly_BP_Filtered.ogv

It's possible that I am not doing the conversion correctly, but I have tried several different variations on the conversion command. The video in question is hosted by Github.

-- http://www.briancjenkins.com/video_test/, http://www.briancjenkins.com/video_test/US_Inflation_Unemployment_Monthly_BP_Filtered.ogv

FFMpeg not muxing audio and video

$
0
0

I'm writing a simple application that is muxing the given mp4 and mp3 files and is extracting mp4 file as result.

fFmpeg = FFmpeg.getInstance(this);
cmd = new String[] {"-i", videoPath, "-i", audioPath, Environment.getExternalStorageDirectory() + "/output.mp4"}; fFmpeg.execute(cmd, new ExecuteBinaryResponseHandler() { @Override public void onStart() { super.onStart(); Log.e(TAG, "Started"); } @Override public void onFailure(String message) { super.onFailure(message); Log.e(TAG, "failed: " + message); } @Override public void onProgress(String message) { super.onProgress(message); Log.e(TAG, "progress: "+ message); } @Override public void onFinish() { super.onFinish(); Log.e(TAG, "finish"); } @Override public void onSuccess(String message) { super.onSuccess(message); Log.e(TAG, "success: " + message); } });

Where videoPath and audioPath are paths to video and audio, for example storage/emulated/0/source.mp4. But I only get a copy of video file without my audio file attached. What is my mistake?

Cannot convert from mts (AVCHD) to mkv using ffmpeg

$
0
0

I was trying to convert a .MTS file from my camcorder (Panasonic HC-V700) to a .mkv file (because my editing software does not support MTS). I used the following command:

ffmpeg -i 00000.MTS -scodec copy -acodec copy -vcodec copy -f matroska 00000.mkv

But instead of getting a mkv file I get this:

ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311 configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv WARNING: library configuration mismatch avcodec configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
Input #0, mpegts, from '00000.MTS': Duration: 00:00:07.68, start: 2.306356, bitrate: 12032 kb/s Program 1 Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
[matroska @ 0x6ce920] Codec for stream 0 does not use global headers but container format requires global headers
[matroska @ 0x6ce920] Codec for stream 1 does not use global headers but container format requires global headers
[matroska @ 0x6ce920] Codec for stream 2 does not use global headers but container format requires global headers
Output #0, matroska, to '00000.mkv': Metadata: encoder : Lavf56.40.101 Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, 256 kb/s Stream #0:2: Subtitle: hdmv_pgs_subtitle ([255][255][255][255] / 0xFFFFFFFF), 1920x1080
Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x6ce920] failed to avoid negative pts -65 in stream 2.
Try -avoid_negative_ts 1 as a possible workaround. Last message repeated 1 times
[matroska @ 0x6ce920] failed to avoid negative pts -63 in stream 2.
Try -avoid_negative_ts 1 as a possible workaround.
[matroska @ 0x6ce920] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument
[matroska @ 0x6ce920] Can't write packet with unknown timestamp
frame= 23 fps=0.0 q=-1.0 Lsize= 187kB time=00:00:00.41 bitrate=3705.7kbits/s video:707kB audio:7kB subtitle:3kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

Any ideas why is it not working? (I am on Kubuntu 16.04 and I have ffmpeg version 2.8.6-1ubuntu2.)

(I'm sorry for my English.)

Edit:

I tried the command without the subtitle stream (ffmpeg -i 00000.MTS -c copy -sn 00000.mkv), conversion failed again:

ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311 configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv WARNING: library configuration mismatch avcodec configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
Input #0, mpegts, from '00000.MTS': Duration: 00:00:07.68, start: 2.306356, bitrate: 12032 kb/s Program 1 Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
[matroska @ 0x1b3a900] Codec for stream 0 does not use global headers but container format requires global headers
[matroska @ 0x1b3a900] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, matroska, to '00000.mkv': Metadata: encoder : Lavf56.40.101 Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, 256 kb/s
Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x1b3a900] Can't write packet with unknown timestamp
av_interleaved_write_frame(): Invalid argument
[matroska @ 0x1b3a900] Can't write packet with unknown timestamp
frame= 17 fps=0.0 q=-1.0 Lsize= 184kB time=00:00:00.28 bitrate=5386.9kbits/s video:554kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

Edit: Temporary solution

I have found out, that converting to mp4 (fmpeg -i 00000.MTS -c copy -sn 00000.mp4) works. This does not solve the issue, but I can use the mp4 format in my editing software as well.

Cross platform library for converting PCM to mp3 in C#

$
0
0

Is there a portable method for converting PCM audio to mp3 that will work both on Windows and Linux in a simple way? I found some FFMPEG wrappers for C#, but none are very user friendly. Also, NAudio and Yeti LAME wrapper seem to work only on Windows

Video duration time FFMpeg PHP

$
0
0

This is probably a dumb question, im trying to get the duration from a video using FFMpeg: Video Duration Time = 1m:47s

My function

$ffmpeg = \FFMpeg\FFProbe::create();
$duration = $ffmpeg->format($videos[0]->real_path)->get('duration');

Now if i print $duration : "109.713333"

How can i get the video duration time from $duration??

Note:

I Tried this

 109.713333 / 60 = 1.82 82/60 = 1.36 and 82-36 = 46

avfiltergraph.c: restore disabling of auto conversions

$
0
0
avfiltergraph.c: restore disabling of auto conversions Restore a check added in 440af105f2306d3c7b3b3f4d7530bab910d49cb9
but lost sometime after. avfilter_graph_set_auto_convert() will
have an effect once again. Signed-off-by: Burt P 
  • [DH] libavfilter/avfiltergraph.c

avfilter/vf_remap: >8 bit support

$
0
0
avfilter/vf_remap: >8 bit support
  • [DH] libavfilter/vf_remap.c

avfilter/avf_showwaves: add sqrt and cbrt amplitude scalers

$
0
0
avfilter/avf_showwaves: add sqrt and cbrt amplitude scalers
  • [DH] doc/filters.texi
  • [DH] libavfilter/avf_showwaves.c

FFmpeg: How to split video efficiently?

$
0
0

I wish to split a large avi video into two smaller consecutive videos. I am using ffmpeg.

One way is to run ffmpeg two times:

ffmpeg -i input.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 output1.avi
ffmpeg -i input.avi -vcodec copy -acodec copy -ss 00:30:00 -t 00:30:00 output2.avi

But according to manpage of ffmpeg, I can make more than one ouput file from one input file using just one line:

ffmpeg -i input.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 output1.avi \ -vcodec copy -acodec copy -ss 00:30:00 -t 00:30:00 output2.avi

My question is, does the later approach save computation time and memory?

Fast accurate video trim like Instagram using FFmpeg Android

$
0
0

I know it's been asked before but I couldn't find a fast and accurate solution yet, I want to trim videos with a maximum lenght of 15 seconds. Here is what I've tried so far, I'm working with this video as example:http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_30mb.mp4

The fastest way

This is by far the fastest way because it doesn't need to re-encode the video but it's very innacurate in this video because the key frames are every 5-10 seconds:

ffmpeg -i SampleVideo_1280x720_30mb.mp4 -ss 30 -to 50 -c copy -y out.mp4

Here is how I check the key frames in this video:

ffprobe -select_streams v -show_frames -show_entries frame=pict_type -of csv SampleVideo_1280x720_30mb.mp4 | grep -n I | cut -d ':' -f 1

With this command I found out that the second key frame it's in the 211th frame which means 210 frames between the first key frame and the second, knowing that it's a 25fps video it would be around 8 seconds between the key frames, so any cut between 1-8 seconds would fall in one of this frames which is a huge difference for a 15 seconds video.

The accurate way

This way it's accurate but it requires to re-encode the video:

ffmpeg -i SampleVideo_1280x720_30mb.mp4 -ss 30 -to 50 -preset ultrafast -y out.mp4

The problem is this command takes more than 20 seconds to finish using the ultrafast preset, in a samsung galaxy s6 edge plus which probably would be much more in other devices.

Nevertheless, if I open the SampleVideo_1280x720_30mb.mp4 in Instagram and trim it they get an accurate trim in less than 2 seconds.

I also tried to force the keyframes every second, but it also requires to re-encode the video and it affects the video quality:

ffmpeg -i SampleVideo_1280x720_30mb.mp4 -force_key_frames "expr:gte(t,n_forced*1)" out.mp4

Does anybody know how Instagram trim the videos or a way to get a fast and accurate trim with FFMpeg?

-- http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_30mb.mp4

Creating MPEG4 video file with Python from raw frames

$
0
0

I have a raw video frame source which I can access in Python. I'd like to create a MPEG4 video out of this, with MP3 background music.

What kind of tools and libraries are available in Python for such a task? Preferably I'd like to have an API for which I can feed output filename and then individual frames as 24 bit raw images.

Viewing all 117718 articles
Browse latest View live


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