Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to encode low bitrate / low quality MPEG2 video ?

    18 février 2017, par Viliams Bajčinovci

    Got some YUV420 1920x1080 60FPS videos i want to encode with MPEG2 with different quality levels. According to stackoverflow: ffmpeg conversion to mpeg2video I could do it with

    ffmpeg -i input -codec:v mpeg2video -qscale:v 10 output.mpg
    

    The qscale parameter has a linear scale 2-31 and 31 is the lowest quality but it's not as bad as I would expect the lowest quality MPEG2 video to look like.

    Also tried these:

    -vcodec mpeg2video -maxrate 4000k
    -vcodec mpeg2video -qmin 69 -qmax 69
    

    maxrate gets ignored and i get the message that it is too low and qmin 69 quality is still higher than i want it to be.

    Does anyone know how to achieve a really low quality MPEG2 video with ffmpeg or any other MPEG2 codec i could use to do this? Thanks

  • How to make mp4 from MediaStream in Chrome browser

    18 février 2017, par otiai10

    MediaRecorder.isTypeSupported('video/mp4') is false in Chrome. So I found MediaStreamRecorder https://github.com/streamproc/MediaStreamRecorder then I did

    var recorder = new MediaStreamRecorder(stream, {
      mimeType: 'video/mp4',
    });
    // also
    recorder.mimeType = 'video/mp4';
    

    But the output is webm as I checked with ffmpeg -i

    Input #0, matroska,webm, from '/Users/otiai10/Downloads/example.mp4':
      Metadata:
        encoder         : Chrome
      Duration: N/A, start: 0.000000, bitrate: N/A
        Stream #0:0(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
    

    The video is playable in Chrome but NOT on QuickTime Player, in evidence.

    Here are more details and (not!) working example of this problem.

    It was said muaz-khan/Ffmpeg.js can convert webm to mp4, but the file size matters.

    Is there any workaround to record and save as mp4?

  • Encode h264 automatically on nginx server

    18 février 2017, par Thinh Pham

    I have installed and configured my own streaming server using Nginx with rtmp module base on this tutorial https://www.vultr.com/docs/setup-nginx-on-ubuntu-to-stream-live-hls-video. I only use live application and record stream into flv file. And now I want to encode any new flv files in my VOD directory automatically to play it on my website. Is it possible to config it in my nginx.conf? I have tried set record_suffix .mp4; in order to play it without encode but failed. Additional, exec ffmpeg -i is not work for me when I want to restream into mobile application.

  • ffmpeg UDP stream error (subtitles)

    18 février 2017, par Peca

    I have HTTP stream which I like to convert to UDP:

    http://192.168.1.44:8001/1:0:1:1F8:1B:2C0:E080000:0:0:0:
    

    The Video, Audio and Subtitle work perfectly If I try to open this stream in VLC n Ubuntu. so far, so good

    Here is otput of FFPROBE

        ffprobe -i http://192.168.1.44:8001/1:0:1:1F8:1B:2C0:E080000:0:0:0:
    ffprobe version git-2017-01-22-f1214ad Copyright (c) 2007-2017 the FFmpeg developers
      built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
      configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab --enable-libwavpack --enable-nvenc
      libavutil      55. 44.100 / 55. 44.100
      libavcodec     57. 75.100 / 57. 75.100
      libavformat    57. 63.100 / 57. 63.100
      libavdevice    57.  2.100 / 57.  2.100
      libavfilter     6. 69.100 /  6. 69.100
      libavresample   3.  2.  0 /  3.  2.  0
      libswscale      4.  3.101 /  4.  3.101
      libswresample   2.  4.100 /  2.  4.100
      libpostproc    54.  2.100 / 54.  2.100
    [mpeg2video @ 0xa56fde0] Invalid frame dimensions 0x0.
        Last message repeated 2 times
    Input #0, mpegts, from 'ht tp://192.168.1.44:8001/1:0:1:1F8:1B:2C0:E080000:0:0:0:':                                                                                                         
      Duration: N/A, start: 35782.514200, bitrate: N/A                                                                                                                                         
      Program 501                                                                                                                                                                             
      Program 502                                                                                                                                                                             
      Program 503                                                                                                                                                                             
      Program 504                                                                                                                                                                             
        Stream #0:0[0x13b1]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc                           
        Stream #0:1[0x13b2]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s                                                                                             
        Stream #0:2[0x1541](srp): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:3[0x1542](slv): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:4[0x1543](hrv): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:5[0x1544](cze): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:6[0x1545](hun): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:7[0x1546](ron): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:8[0x1547](alb): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:9[0x1548](bul): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)                                                                                                               
        Stream #0:10[0x13b9](eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)                                                                                                             
      Program 505                                                                                                                                                                             
      Program 506
      Program 507
      Program 508
      Program 509
      Program 510
      Program 511
      Program 515
      Program 516
      Program 517
      Program 518
      Program 519
      Program 520
      Program 521
    Unsupported codec with id 94215 for input stream 10
    

    So I decide to use FFMPEG to stream to UDP, and filter out unwanted SUB's

    Here is FFMPEG cmd

    ffmpeg -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2048 \
        -i "http://192.168.1.44:8001/1:0:1:1F8:1B:2C0:E080000:0:0:0:" \
        -map 0:0 -vcodec copy \
        -map 0:1 -acodec copy \
        -map 0:2 -map 0:6 -scodec copy \
        -f mpegts udp://239.0.10.3:40000?pkt_size=1316
    

    And the output is:

        Output #0, mpegts, to 'udp://239.0.10.3:40000?pkt_size=1316':
      Metadata:
        encoder         : Lavf57.63.100
        Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
        Stream #0:1: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s
        Stream #0:2(srp): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
        Stream #0:3(hun): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
      Stream #0:1 -> #0:1 (copy)
      Stream #0:2 -> #0:2 (copy)
      Stream #0:6 -> #0:3 (copy)
    

    And the resulting stream is DISASTER ... audio is choppy, video fall apart etc etc

    If I try same thing WITHOUT sub's (map 2 and 6) the video and audio is crystal clear and stream work well

    But I need this two sub's.

    To narrow down the problem, if I try to capture incoming stream into file:

    ffmpeg -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 2048 \
    -i "http://192.168.1.44:8001/1:0:1:1F8:1B:2C0:E080000:0:0:0:" \
    -map 0:0 -map 0:1 -map 0:2 -map 0:6 \
    -codec copy \
    -y -f mpegts /tmp/tst.ts
    

    The resulting file is playable, sound OK, video OK, subtitles OK.

    Looks like problem is with OUTPUT to UDP ???

    Any solution for this ?

  • How can I use php-FFMpeg in laravel 5.1 to convert uploaded GIF image to video format automatically ?

    18 février 2017, par Lastbusy.com

    I have installed php-ffmpeg in my localhost Laravel setup, but I need help on how to use ffmpeg with Laravel 5.1.

    I need this to convert gif image into .mp4 video format automatically. When site visitors/users upload GIF image, it should be converted into .mp4 format. (Example: Gif uploaded in 9gag.com)

    Please also suggest if there is any alternative solution to the requirement.