Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • ffmpeg works manually but not with cron ?

    2 mai 2017, par mdnba50

    I can successfully convert mp3 + audio to mp4 when i run the script manually.

    exec("/usr/bin/ffmpeg -loop 1 -i $destination_thumbnail -i $input_file -c:a copy -c:v libx264 -shortest $videoPath 2>&1",$output);
    

    When i have the above code in a script executed via cron it doesn't convert. I get this error.

    Array
    (
        [0] => ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
        [1] =>   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
        [2] =>   configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
        [3] =>   libavutil      54. 20.100 / 54. 20.100
        [4] =>   libavcodec     56. 26.100 / 56. 26.100
        [5] =>   libavformat    56. 25.101 / 56. 25.101
        [6] =>   libavdevice    56.  4.100 / 56.  4.100
        [7] =>   libavfilter     5. 11.102 /  5. 11.102
        [8] =>   libavresample   2.  1.  0 /  2.  1.  0
        [9] =>   libswscale      3.  1.101 /  3.  1.101
        [10] =>   libswresample   1.  1.100 /  1.  1.100
        [11] =>   libpostproc    53.  3.100 / 53.  3.100
        [12] => [mp3 @ 0x1d62bc0] Estimating duration from bitrate, this may be inaccurate
        [13] => Input #0, mp3, from '/home/example/public_html/wp-content/channels/videos/temp_1473937603.mp3':
        [14] =>   Duration: 00:06:51.05, start: 0.000000, bitrate: 64 kb/s
        [15] =>     Stream #0:0: Audio: mp3, 16000 Hz, stereo, s16p, 64 kb/s
        [16] => [mjpeg @ 0x1d73de0] Changeing bps to 8
        [17] => Input #1, image2, from '/home/examples/public_html/wp-content/channels/thumbnails/thumbnail_516919517.jpg':
        [18] =>   Duration: 00:00:00.50, start: 0.000000, bitrate: N/A
        [19] =>     Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 250x135 [SAR 1:1 DAR 50:27], 2 fps, 2 tbr, 2 tbn, 2 tbc
        [20] => No pixel format specified, yuvj420p for H.264 encoding chosen.
        [21] => Use -pix_fmt yuv420p for compatibility with outdated media players.
        [22] => [libx264 @ 0x1d75240] height not divisible by 2 (250x135)
        [23] => Output #0, mp4, to '/home/example/public_html/wp-content/channels/videos/temp_1473937603.mp4':
        [24] =>     Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 2 fps
        [25] =>     Metadata:
        [26] =>       encoder         : Lavc56.26.100 libx264
        [27] =>     Stream #0:1: Audio: none, 0 channels, 128 kb/s
        [28] => Stream mapping:
        [29] =>   Stream #1:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
        [30] =>   Stream #0:0 -> #0:1 (copy)
        [31] => Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    )
    

    Why does this work when i manually execute the script in conversion.php but when i run conversion.php via cron i get the above error?

  • H264 to MP4 with Bframe play back and forth on google chrome[ffmpeg]

    2 mai 2017, par Ravi Agola

    I want to generate a mp4 container with h264 encoded file.

    H264 file contains [I P B B][P B B][P B B][P B B] frames.

    when I generate a mp4 file with FFmpeg, It works well with FFplay as well as VLC but on google-chrome mp4 file plays frame back and forth.

    ffmpeg -i input.h264 -vcodec copy output.mp4

    when i use internal codec library(libx264) it works well on (ffplay,vlc and google-chrome)

    ffmpeg -i input.h264 -vcodec h264 output.mp4

    as above command transcode h264(native) to h264(x264), I don't want to transcode file as I will be using it with ffmpeg library.

    when I use h264 without B frame it works well in both cases.

    I have tried some experiment with sample test file available here.

    direct conversion(MKV to MP4) works well with chrome as below

    ffmpeg -i jellyfish-3-mbps-hd-h264.mkv -vcodec copy output.mp4

    (MKV to H264 and H264 to MP4) plays back and forth on chrome

    ffmpeg -i jellyfish-3-mbps-hd-h264.mkv -vcodec copy output.h264
    ffmpeg -i output.h264 -vcodec copy output.mp4

    I get message in this case
    [mp4 @ 0xb6f8b20] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    [mp4 @ 0xb6f8b20] pts has no value"

    what can be a reason behind this behavior?

    Thanks.

  • Executing ffmpeg command in Cmd with vertical Bar

    2 mai 2017, par CSDD

    I am trying to use the postprocessing command from ffmpeg wtih command prompt.

    pp=hb/vb/dr/fq|8
    

    Here is the overall syntax: https://ffmpeg.org/ffmpeg-filters.html#pp

    However, the vertical makes Window CMD think that I am trying to execute another command. So how to bypass this to make the command run correctly?

  • How do I have to change the .mp4-file ?

    2 mai 2017, par Manfred Muckler

    I have an issue with a .mp4 file. My source file has the following specifications:

    mimeType="video/mp4" codecs="avc1.64001f,mp4a.40.2" width="1280" height="720" frameRate="25"
    

    How do I have to change or convert the file that I can play it on a device that supports the following video codecs:

    File format: *.mp4; Container: MP4; Video codecs: H.264 BP/MP/HP up to 4096p x 2160p and max. 40 Mbps Bitrate; Audio codecs: AAC, HE-AAC, MPEG(MP3)

  • How to force key frames at given interval using ffmpeg with h.264_qsv ?

    2 mai 2017, par user3753682

    I use the following command to force key frames every 5th second and set minimum key frame interval in ffmpeg.

    ffmpeg -i input.mp4 -c:v libx264 -pix_fmt yuv420p -r 24 profile:v baseline -level 3.0 -x264opts keyint=$keyFrameInterval:min-keyint=$keyFrameInterval:no-scenecut:pass=1 -movflags +faststart -strict -2 -acodec aac -y output.mp4
    

    This seems to work well with libx264. Now i am using the following command with h264_qsv. But i could only force key frames every 5th second and couldn't set minimum key frame interval.

    ffmpeg -hwaccel qsv -i input.mp4 -vcodec h264_qsv -pix_fmt nv12 -preset:v faster -profile:v baseline -level 3.0 -force_key_frames "expr:gte(t,n_forced*5)" -movflags +faststart -strict -2 -acodec aac -f mp4 -r 24 -y output.mp4
    

    How do i achieve the above with h264_qsv?