Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Crash is happening while playing a video where my iOS app is integrated with VideoKit and mobileFFMpeg frameworks
25 juin 2019, par vinayI am using MobileFFMpeg for executing the FFmpeg commands in ios application , As I am using mobileFFMPeg for sending the live stream from ip camera to Azure server ..... And it is working fine
And the problem is my application is crashing when I integrate the iOS VideoKit with this MobileFFmpeg
This is the cocoapod that I have used to installed the MobileFFMpeg
pod 'mobile-ffmpeg-full-gpl', '~> 4.2'
MobileFFmpeg.execute("-i video.mkv -codec copy video.mp4") ---------- for executing ffmpeg commands
if(avformat_find_stream_info(_avFmtCtx, opts) < 0) { [self setDecoderState:kVKDecoderStateConnectionFailed errorCode:kVKErrorStreamInfoNotFound]; return kVKErrorStreamInfoNotFound; }
---------------------------> This is the point where the application is crashing while playing a video with the videoKit framework. :)
I expect iOS VideoKit with work fine with MobileFFmpeg without any crashes and execute the ffmpeg commands. :)
-
Accessing data of fmmpeg while processing in node.js
25 juin 2019, par newCOder2137sshIm converting a .mp4 file with ffmpeg to a .mp3 file.I am only able to access this data after ffmpeg finished, but I want to access it while it is processing.
I am currently using fluent-ffmpeg to process the video. This is how I process it:
proc = new ffmpeg({ source: stream }) proc.withAudioCodec('libmp3lame') .toFormat('mp3') .seekInput(35) .output(audio) .run();
I can access the data after ffmpeg fiinished with
proc.on('end', ())
but I'd like to access the data while it's processing and make a reeadable Stream out of it. Does someone know how to do that? -
What parameter should use to create adaptive hls videos in different scale using ffmpeg and shaka packager for VOD streaming ?
25 juin 2019, par RahulI am trying to package HLS with shaka packager in a different scale from
144x256
to1080x1920
for adaptive streaming usinghevc
, It is working fine, but Is there some more parameter required to put for good video quality and optimization.Below are the command I used :
ffmpeg -i original.mp4 -c:a aac -strict experimental -b:a 128k -c:v libx265 -vf scale=144:256 144_256_h265.mp4 -hide_banner ffmpeg -i original.mp4 -c:a aac -strict experimental -b:a 128k -c:v libx265 -vf scale=360:640 360_640_h265.mp4 -hide_banner ffmpeg -i original.mp4 -c:a aac -strict experimental -b:a 128k -c:v libx265 -vf scale=720:1280 720_1280_h265.mp4 -hide_banner ffmpeg -i original.mp4 -c:a aac -strict experimental -b:a 128k -c:v libx265 -vf scale=1080:1920 1080_1920_h265.mp4 -hide_banner HLS Packaging Using shaka packager. packager-osx in=144_256_h265.mp4,stream=audio,output=hls/audio.mp4,playlist_name=audio.m3u8,hls_group_id=audio,hls_name=ENGLISH in=144_256_h265.mp4,stream=video,output=hls/h265_144p.mp4,playlist_name=h265_144p.m3u8,iframe_playlist_name=h265_144p_iframe.m3u8 in=360_640_h265.mp4,stream=video,output=hls/h265_360p.mp4,playlist_name=h265_360p.m3u8,iframe_playlist_name=h265_360p_iframe.m3u8 in=720_1280_h265.mp4,stream=video,output=hls/h265_720p.mp4,playlist_name=h265_720p.m3u8,iframe_playlist_name=h265_720p_iframe.m3u8 in=1080_1920_h265.mp4,stream=video,output=hls/h265_1080p.mp4,playlist_name=h265_1080p.m3u8,iframe_playlist_name=h265_1080p_iframe.m3u8 --hls_master_playlist_output hls/h265_master.m3u8
-
How to fix : Frame rate differs from source after encoding certain mp4 videos to wmv
25 juin 2019, par hpenhpI'm having trouble with a usually working ffmpeg script for encoding mp4 and more to wmv. The goal is to keep it like the original, except for the resolution (smaller) and the format (wmv).
When it usually works for a lot of videos, on some of them it doesn't... and i would like to understand and avoid that.
I tried several things, forcing the framerate for the output, using -vsync 2 option, -vsync 0 also.. noone of that fixed the issue.
An other thing, worth adding, is that the fps value from media info is good (24 fps) on the output like the input, but through the M$ windows explorer, it says 30 frames per sec, and when you play the video you see that the text that was matching the input doesn't match the output any more (because of the fps mismatching).
Below the script i use :
ffmpeg -threads auto -i input.mp4 -s 480*320 -b:v 1000k -vcodec msmpeg4 -acodec wmav2 -f asf output.wmv
Here is the ffmpeg log :
ffmpeg version 3.4.1-1~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609 configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared WARNING: library configuration mismatch avcodec configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './test_2k-24__hq_960x540.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42mp41isomavc1 creation_time : 2019-05-27T14:37:50.000000Z Duration: 01:28:52.80, start: 0.000000, bitrate: 1232 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 960x540, 1091 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default) Metadata: creation_time : 2019-05-27T14:37:50.000000Z handler_name : L-SMASH Video Handler encoder : AVC Coding Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 137 kb/s (default) Metadata: creation_time : 2019-05-27T14:37:50.000000Z handler_name : L-SMASH Audio Handler Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> msmpeg4v3 (msmpeg4)) Stream #0:1 -> #0:1 (aac (native) -> wmav2 (native)) Press [q] to stop, [?] for help Output #0, asf, to '/nas/copiedetravail/test_2k-24__hq_960x540.mp4.wmv': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42mp41isomavc1 WM/EncodingSettings: Lavf57.83.100 Stream #0:0(und): Video: msmpeg4v3 (msmpeg4) (MP43 / 0x3334504D), yuv420p(progressive), 480x320, q=2-31, 1000 kb/s, 24 fps, 1k tbn, 24 tbc (default) Metadata: creation_time : 2019-05-27T14:37:50.000000Z handler_name : L-SMASH Video Handler encoder : Lavc57.107.100 msmpeg4 Side data: cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: -1 Stream #0:1(und): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2019-05-27T14:37:50.000000Z handler_name : L-SMASH Audio Handler encoder : Lavc57.107.100 wmav2 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 31 times frame= 228 fps=0.0 q=2.0 size= 291kB time=00:00:09.45 bitrate= 252.4kbits/s speed=18.9x [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 1 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 Last message repeated 1 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 Last message repeated 1 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 Last message repeated 5 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 2 times frame= 449 fps=449 q=2.0 size= 663kB time=00:00:18.98 bitrate= 286.2kbits/s speed= 19x frame= 629 fps=418 q=1.6 size= 1307kB time=00:00:26.16 bitrate= 409.2kbits/s speed=17.4x [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 30 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 7 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 2 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 34 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 1 times frame= 821 fps=410 q=2.0 size= 1960kB time=00:00:34.26 bitrate= 468.7kbits/s speed=17.1x [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 71 times [msmpeg4 @ 0x5648e407cb60] warning, clipping 2 dct coefficients to -127..127 [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 82 times frame= 1026 fps=409 q=2.0 size= 2695kB time=00:00:42.96 bitrate= 513.8kbits/s speed=17.1x [msmpeg4 @ 0x5648e407cb60] warning, clipping 1 dct coefficients to -127..127 Last message repeated 102 times frame= 1202 fps=400 q=1.6 size= 3754kB time=00:00:50.13 bitrate= 613.4kbits/s speed=16.7x ...... frame=127987 fps=301 q=2.0 Lsize= 753842kB time=01:28:52.77 bitrate=1158.0kbits/s speed=12.6x video:650704kB audio:83244kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.710554%
EDIT : My workaround was to encode to MPEG, doing this, i'm able to read my file and the frame rate is same as source. If someone knows why it couldn't keep the original framerate in wmv, i'm still interested to know.
-
PHP-FFMpeg video output is truncated
25 juin 2019, par showdevI'm using the PHP-FFMpeg library found here and code from the "Basic Usage" section.
The outputted video seems to be truncated. I'm using a source video that's 28 seconds long, but the output is only 9 seconds. What's going wrong?
Here, I'm checking the duration of the source video:
$ffprobe = FFMpeg\FFProbe::create(); $duration = $ffprobe ->format('test/source.mp4') ->get('duration');
28.700000
Then generating an output video:
$ffmpeg = FFMpeg\FFMpeg::create(); $video = $ffmpeg->open('test/source.mp4'); $video->save(new FFMpeg\Format\Video\X264(), 'test/export.mp4');
Then checking the duration of the output video:
$ffprobe = FFMpeg\FFProbe::create(); $duration = $ffprobe ->format('test/export.mp4') ->get('duration');
9.234000