2

I am making a mp4 video while using this command from downloaded jpegs, everything is working fine but the video is not being played in VLC but in Media Player, default one of Ubuntu.

ffmpeg -y -framerate 6 -i #{path}%d.jpg -i #{evercam_logo} -filter_complex '[1]scale=iw/2:-1[wm];[0][wm]overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10' -pix_fmt yuv420p -c:v h264_nvenc -preset slow -bufsize 1000k #{path}#{id}.mp4

I have tried multiple formats but the results are same. what Am I missing here? any help would be wonderful thank you.

my FFMPEG version:

ffmpeg version N-95730-ga7245adee3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: 
  libavutil      56. 35.101 / 56. 35.101
  libavcodec     58. 62.100 / 58. 62.100
  libavformat    58. 35.100 / 58. 35.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 66.100 /  7. 66.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

FFMPEG is being compiled with Nvidia Graphics.

UPDATE: this is the output of my full command

root@Ubuntu-1704-zesty-64-minimal:~# ffmpeg -y -framerate 6 -i /storage/apache-j8h3/%d.jpg -i /opt/evercam_media/lib/evercam_media-1.0.1583305674/priv/static/images/evercam-logo-white.png -filter_complex '[1]scale=iw/2:-1[wm];[0][wm]overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10,format=yuv420p' -c:v h264_nvenc -preset slow -bufsize 1000k videotest.mp4
ffmpeg version N-95730-ga7245adee3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: 
  libavutil      56. 35.101 / 56. 35.101
  libavcodec     58. 62.100 / 58. 62.100
  libavformat    58. 35.100 / 58. 35.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 66.100 /  7. 66.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Input #0, image2, from '/storage/apache-j8h3/%d.jpg':
  Duration: 00:00:09.50, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 704x576 [SAR 1:1 DAR 11:9], 6 fps, 6 tbr, 6 tbn, 6 tbc
Input #1, png_pipe, from '/opt/evercam_media/lib/evercam_media-1.0.1583305674/priv/static/images/evercam-logo-white.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 200x200 [SAR 2835:2835 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (mjpeg) -> overlay:main
  Stream #1:0 (png) -> scale
  format -> Stream #0:0 (h264_nvenc)
Press [q] to stop, [?] for help
[image2 @ 0x555f0a16ba80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[swscaler @ 0x555f0a36ff80] deprecated pixel format used, make sure you did set range correctly
Output #0, mp4, to 'videotest.mp4':
  Metadata:
    encoder         : Lavf58.35.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), yuv420p, 704x576 [SAR 1:1 DAR 11:9], q=-1--1, 2000 kb/s, 6 fps, 12288 tbn, 6 tbc (default)
    Metadata:
      encoder         : Lavc58.62.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 1000000 vbv_delay: N/A
frame=   57 fps=0.0 q=20.0 Lsize=    2332kB time=00:00:09.33 bitrate=2046.8kbits/s speed=19.3x    
video:2331kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.045540%

and this is the output of a command with -pix_fmt yuv420p

root@Ubuntu-1704-zesty-64-minimal:~# ffmpeg -y -framerate 6 -i /storage/apache-j8h3/%d.jpg -i /opt/evercam_media/lib/evercam_media-1.0.1583305674/priv/static/images/evercam-logo-white.png -filter_complex '[1]scale=iw/2:-1[wm];[0][wm]overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10' -c:v h264_nvenc -preset slow -bufsize 1000k -pix_fmt yuv420p videotest.mp4
ffmpeg version N-95730-ga7245adee3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: 
  libavutil      56. 35.101 / 56. 35.101
  libavcodec     58. 62.100 / 58. 62.100
  libavformat    58. 35.100 / 58. 35.100
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 66.100 /  7. 66.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Input #0, image2, from '/storage/apache-j8h3/%d.jpg':
  Duration: 00:00:09.50, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 704x576 [SAR 1:1 DAR 11:9], 6 fps, 6 tbr, 6 tbn, 6 tbc
Input #1, png_pipe, from '/opt/evercam_media/lib/evercam_media-1.0.1583305674/priv/static/images/evercam-logo-white.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 200x200 [SAR 2835:2835 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (mjpeg) -> overlay:main
  Stream #1:0 (png) -> scale
  overlay -> Stream #0:0 (h264_nvenc)
Press [q] to stop, [?] for help
[image2 @ 0x557669b1fb00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[swscaler @ 0x557669d23bc0] deprecated pixel format used, make sure you did set range correctly
Output #0, mp4, to 'videotest.mp4':
  Metadata:
    encoder         : Lavf58.35.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), yuv420p, 704x576 [SAR 1:1 DAR 11:9], q=-1--1, 2000 kb/s, 6 fps, 12288 tbn, 6 tbc (default)
    Metadata:
      encoder         : Lavc58.62.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 1000000 vbv_delay: N/A
frame=   57 fps=0.0 q=20.0 Lsize=    2332kB time=00:00:09.33 bitrate=2046.8kbits/s speed=19.8x    
video:2331kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.045540%
  • I believe this is your question answered: superuser.com/questions/820134/… – Florian Claaßen Mar 4 at 15:51
  • I have tried 10:y=main_h-overlay_h-10,format=yuv420p' this dont work – Junaid Farooq Mar 4 at 17:38
  • also if you see above command. I am already using -pix_fmt yuv420p – Junaid Farooq Mar 4 at 17:46
  • 1
    Show the full log from your command. Otherwise we can only guess. What is your VLC version? Lazy guess is to try a higher -framerate value than 6, or add -r output option with higher value than 6. – llogan Mar 4 at 20:00
  • @llogan I have updated the full command log – Junaid Farooq Mar 5 at 6:32
0

The frame rate is too low for some players. Increase -framerate value or add the -r option. Anything ≥8 should suffice. Example:

ffmpeg -y -framerate 6 -i /storage/apache-j8h3/%d.jpg -i /opt/evercam_media/lib/evercam_media-1.0.1583305674/priv/static/images/evercam-logo-white.png -filter_complex '[1]scale=iw/2:-1[wm];[0][wm]overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10,format=yuv420p' -c:v h264_nvenc -preset slow -bufsize 1000k -r 12 videotest.mp4

In the case above with usage of -r then frames will be duplicated to convert from 6 fps to 12 fps, but it won't be noticeable by the viewer.

| improve this answer | |
  • can you explain more about -r option? – Junaid Farooq Mar 7 at 4:32
  • also I have tested to create a clip with -r 12, it also increases the size of the file without -r it 2.8 mb and with -r its 3.7 mb – Junaid Farooq Mar 7 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.