3

I'm using Ubuntu 14.04 and have compiled ffmpeg 2.8.4 from source with these options:

./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-shared

I have a set of files number consecutively from 0..n and have tried to use the "%03d" as part of my input like so:

ffmpeg -y -pix_fmt yuv420p -s qvga -start_number 0 -i picture%03d.yuv -f mp4 -vcodec libx264 -s qvga -an -threads 0 output.mp4

With and without the start_number it fails to find the files and yields this error message on the terminal:

ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers 
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04) 
configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-shared
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
picture%03d.yuv: No such file or directory

Here's a short listing of some of the files in the directory as proof they exist:

picture0.yuv    picture153.yuv  picture206.yuv  picture25.yuv   picture312.yuv  picture4.yuv
picture100.yuv  picture154.yuv  picture207.yuv  picture260.yuv  picture313.yuv  picture50.yuv
picture101.yuv  picture155.yuv  picture208.yuv  picture261.yuv  picture314.yuv  picture51.yuv
picture102.yuv  picture156.yuv  picture209.yuv  picture262.yuv  picture315.yuv  picture52.yuv
picture103.yuv  picture157.yuv  picture20.yuv   picture263.yuv  picture316.yuv  picture53.yuv
picture104.yuv  picture158.yuv  picture210.yuv  picture264.yuv  picture317.yuv  picture54.yuv
picture105.yuv  picture159.yuv  picture211.yuv  picture265.yuv  picture318.yuv  picture55.yuv
picture106.yuv  picture15.yuv   picture212.yuv  picture266.yuv  picture319.yuv  picture56.yuv

Any assistance on this would be awesome, thanks in advance.

Edit - Working command

ffmpeg -y -vcodec rawvideo -pix_fmt yuv420p -s qvga -start_number 0 -f image2 -i picture%d.yuv -f mp4 -vcodec libx264 -s qvga -an -threads 0 output.mp4
6
  • Do printf-type format specifiers work for input files? I thought they were only for the output? You should be able to use shell globs instead e.g. -pattern_type glob 'picture???.yuv' (or 'picture*.yuv' if you don't really want to exclude files with indices < 100) Commented Jan 8, 2016 at 16:46
  • I'll try that, but I got my example from FFMpeg trac: trac.ffmpeg.org/wiki/… Commented Jan 8, 2016 at 17:02
  • 1
    I thought that ffmpeg was deprecated in favor of avconv Commented Jan 8, 2016 at 19:03
  • 1
    @AndreaCorbellini They seem to continue to be developed in parallel; I'm a little confused by that as well Commented Jan 8, 2016 at 19:23
  • 2
    @AndreaCorbellini See What are the differences and similarities between ffmpeg, libav, and avconv?
    – llogan
    Commented Jan 8, 2016 at 20:04

2 Answers 2

3

Your input file names lack zero padding, so use -i picture%d.yuv.

Other stuff:

  • Make sure there are no missing file or breaks in your sequence.

  • Your output options -f mp4, -s qvga, -an, and -threads 0 are superfluous in this case.

2
  • This works, but I had to add -vcodec rawvideo before the -i Commented Jan 8, 2016 at 22:56
  • Without the vcodec, I got this error: [image2 @ 0x2125760] Could not find codec parameters for stream 0 (Video: none, yuv420p, 320x240): unknown codec Commented Jan 8, 2016 at 22:58
2

try to add -f image2 before -i picture%03d.yuv.

Edit : workaround.

if you are trying to encode all yuv files to single mp4 you could create a single yuv file e.g.:

cat picture*.yuv > hugefile.yuv

and encode a single yuv file afterwards.

Edit: keep natural sorting.

To keep natural sort order we can use -v option of the ls command:

cat $(ls -v picture*) > hugefile.yuv
4
  • Adding that gives me this: [image2 @ 0x131e760] Could find no file with path 'picture%03d.yuv' and index in the range 0-4 picture%03d.yuv: No such file or directory Commented Jan 8, 2016 at 16:39
  • @PaulGregoire hmm. and if you change picture%03d.yuv to picture%*.yuv? Commented Jan 8, 2016 at 16:49
  • Concatenating the files together works, hopefully the order is preserved. If I don't get a better answer, I'll give you the check mark; Cat is more of a work around rather than an answer as to why ffmpeg doesnt find the files. Commented Jan 8, 2016 at 17:18
  • @PaulGregoire yeah. thats right the order will be probably broken. Actually I used image2 thing in the past and it worked for images. But there should be a better way to do this. Commented Jan 8, 2016 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .