Convert Single Image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Convert Single Image

Damien Gallagher
Hi

I am trying to convert a single jpg image to a video
I am creating a list of training videos and I want to an intro video based
on images I create used Graphics2D in java

When I run the following command - it runs fine
ffmpeg.exe -y -v error -i intro.jpg -r 1/5 intro_1.mp4

The file will play on my pc but it wont play in youtube or on my android
phone

Are there any restrictions on the image type / size or the generated video?

Thank you
Damien
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Kieran O Leary
Hi,

On 4 Dec 2017 17:45, "Damien Gallagher" <[hidden email]> wrote:

Hi

I am trying to convert a single jpg image to a video
I am creating a list of training videos and I want to an intro video based
on images I create used Graphics2D in java

When I run the following command - it runs fine
ffmpeg.exe -y -v error -i intro.jpg -r 1/5 intro_1.mp4

The file will play on my pc but it wont play in youtube or on my android
phone

Are there any restrictions on the image type / size or the generated video?


It might be a pixel format compatibility issue. (Are you using it  VLC on
your PC by any chance?)

Try adding
-pix_fmt yuv420p
to your command line and see if that helps.

We will most likely be able to figure it out if you copy/paste your
complete uncut terminal output into this email thread.

Best,

Kieran
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Damien Gallagher
Hi Kieran

Thank you for getting back to me
Based on running the following command
ffmpeg.exe -y -i intro.jpg -r 1/5 -pix_fmt yuv420p intro_1.mp4

I get this output
ffmpeg version N-89343-g83ecdc9a92 Copyright (c) 2000-2017 the FFmpeg
developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
--enable-libmfx
  libavutil      56.  4.100 / 56.  4.100
  libavcodec     58.  6.102 / 58.  6.102
  libavformat    58.  2.103 / 58.  2.103
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  5.100 /  7.  5.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, image2, from 'intro.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 133598 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown),
6732x4320 [SAR 300:300 DAR 187:120], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 0000025851dab340] deprecated pixel format used, make sure you
did set range correctly
[libx264 @ 00000258518a4a00] using SAR=1/1
[libx264 @ 00000258518a4a00] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 00000258518a4a00] profile High, level 6.0
[libx264 @ 00000258518a4a00] 264 - core 152 r2851 ba24899 - H.264/MPEG-4
AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6
lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'intro_1.mp4':
  Metadata:
    encoder         : Lavf58.2.103
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
6732x4320 [SAR 1:1 DAR 187:120], q=-1--1, 0.20 fps, 16384 tbn, 0.20 tbc
    Metadata:
      encoder         : Lavc58.6.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    1 fps=0.2 q=17.0 Lsize=     247kB time=00:00:00.00
bitrate=33182163.9kbits/s speed=9.41e-006x
video:246kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.324351%
[libx264 @ 00000258518a4a00] frame I:1     Avg QP: 5.69  size:251508
[libx264 @ 00000258518a4a00] mb I  I16..4: 63.2% 36.2%  0.7%
[libx264 @ 00000258518a4a00] 8x8 transform intra:36.2%
[libx264 @ 00000258518a4a00] coded y,uvDC,uvAC intra: 14.3% 9.8% 4.7%
[libx264 @ 00000258518a4a00] i16 v,h,dc,p: 98%  0%  1%  0%
[libx264 @ 00000258518a4a00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 44% 12% 33%
1%  2%  2%  2%  2%  2%
[libx264 @ 00000258518a4a00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 27%  7%
3%  7%  5%  5%  2%  2%
[libx264 @ 00000258518a4a00] i8c dc,h,v,p: 89%  4%  5%  2%
[libx264 @ 00000258518a4a00] kb/s:402.41

As an fyi - I had my own intro image
I downloaded this image from the web and renamed it intro.jpg and the issue
happens
https://static.gamespot.com/uploads/scale_large/1568/15683559/3318220-4k+intro.jpg

Thanks
Damien

On Mon, Dec 4, 2017 at 6:17 PM, Kieran O Leary <[hidden email]>
wrote:

> Hi,
>
> On 4 Dec 2017 17:45, "Damien Gallagher" <[hidden email]>
> wrote:
>
> Hi
>
> I am trying to convert a single jpg image to a video
> I am creating a list of training videos and I want to an intro video based
> on images I create used Graphics2D in java
>
> When I run the following command - it runs fine
> ffmpeg.exe -y -v error -i intro.jpg -r 1/5 intro_1.mp4
>
> The file will play on my pc but it wont play in youtube or on my android
> phone
>
> Are there any restrictions on the image type / size or the generated video?
>
>
> It might be a pixel format compatibility issue. (Are you using it  VLC on
> your PC by any chance?)
>
> Try adding
> -pix_fmt yuv420p
> to your command line and see if that helps.
>
> We will most likely be able to figure it out if you copy/paste your
> complete uncut terminal output into this email thread.
>
> Best,
>
> Kieran
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Reindl Harald


Am 04.12.2017 um 19:30 schrieb Damien Gallagher:
> Thank you for getting back to me
> Based on running the following command
> ffmpeg.exe -y -i intro.jpg -r 1/5 -pix_fmt yuv420p intro_1.mp4

years ago i wrote a PHP wrapper to get a image with a audio file merged
and a lot of players did only show a single image and then only the
audio - in that case "-loop_input -i imagefile" did the trick to repeat
the image for the full length of audio

the last time i tried this script it did no longer work at all with
recent ffmpeg but i had no time to look what was wrong - probably
something else in the generated command line and -loop_input still works
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Lou Logan
In reply to this post by Damien Gallagher
On Mon, Dec 4, 2017, at 08:45 AM, Damien Gallagher wrote:

> Hi
>
> I am trying to convert a single jpg image to a video
> I am creating a list of training videos and I want to an intro video
> based
> on images I create used Graphics2D in java
>
> When I run the following command - it runs fine
> ffmpeg.exe -y -v error -i intro.jpg -r 1/5 intro_1.mp4
>
> The file will play on my pc but it wont play in youtube or on my android
> phone
>
> Are there any restrictions on the image type / size or the generated
> video?

To make a video from a single image you'll need to loop it, provide a
not-too-low frame rate, and a duration:

ffmpeg -loop 1 -framerate 10 -t 5 -i input.jpg -vf format=yuv420p
output.mp4

If the duration is long you can save a little time by using a low input
-framerate then change the output frame rate with the -r output option
or fps filter with a more common rate.

Your Android player will require "-vf format=yuv420p" (or the "-pix_fmt
yuv420p" alias) but YouTube will not.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Damien Gallagher
Would the following look like a decent setup?
ffmpeg.exe -y -v error -loop 1 -framerate 24 -t 5 -i intro.jpg -vf
format=yuv420p -r 24/1 output.mp4

On Mon, Dec 4, 2017 at 7:15 PM, Lou Logan <[hidden email]> wrote:

> On Mon, Dec 4, 2017, at 08:45 AM, Damien Gallagher wrote:
> > Hi
> >
> > I am trying to convert a single jpg image to a video
> > I am creating a list of training videos and I want to an intro video
> > based
> > on images I create used Graphics2D in java
> >
> > When I run the following command - it runs fine
> > ffmpeg.exe -y -v error -i intro.jpg -r 1/5 intro_1.mp4
> >
> > The file will play on my pc but it wont play in youtube or on my android
> > phone
> >
> > Are there any restrictions on the image type / size or the generated
> > video?
>
> To make a video from a single image you'll need to loop it, provide a
> not-too-low frame rate, and a duration:
>
> ffmpeg -loop 1 -framerate 10 -t 5 -i input.jpg -vf format=yuv420p
> output.mp4
>
> If the duration is long you can save a little time by using a low input
> -framerate then change the output frame rate with the -r output option
> or fps filter with a more common rate.
>
> Your Android player will require "-vf format=yuv420p" (or the "-pix_fmt
> yuv420p" alias) but YouTube will not.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Carl Eugen Hoyos-2
2017-12-04 20:42 GMT+01:00 Damien Gallagher <[hidden email]>:
> Would the following look like a decent setup?
> ffmpeg.exe -y -v error -loop 1 -framerate 24 -t 5 -i intro.jpg -vf
> format=yuv420p -r 24/1 output.mp4

A lower framerate should produce a smaller file.

Please do not top-post here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Convert Single Image

Lou Logan
In reply to this post by Damien Gallagher
On Mon, Dec 4, 2017, at 10:42 AM, Damien Gallagher wrote:
> Would the following look like a decent setup?
> ffmpeg.exe -y -v error -loop 1 -framerate 24 -t 5 -i intro.jpg -vf
> format=yuv420p -r 24/1 output.mp4

No need for the "-r 24/1" because you already set "-framerate 24". The
output will use the input frame rate unless you tell it not to.
Otherwise, should be fine I guess. You can experiment with a lower frame
rate to see what frame rate will decode properly in your supported
players.

You can also adjust the -crf and -preset values for the encoder libx264.
See:
https://trac.ffmpeg.org/wiki/Encode/H.264
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".