[FFmpeg-user] Transcoding foscam mkv to mp4 is resulting in larger files

Steve Boyer steveboyer85 at gmail.com
Sun Sep 13 06:27:45 CEST 2015


On Sat, Sep 12, 2015 at 11:24 PM, Steve Boyer <steveboyer85 at gmail.com>
wrote:

>
>
> On Sat, Sep 12, 2015 at 11:03 PM, Kai Hendry <kai.hendry at gmail.com> wrote:
>
>> Hi guys,
>
>
>
>>
>
> The Input #0, mpeg transcoding into mp4 (for iPhone playback via
>> Safari) is resulting in up 3x larger files. Why is that?
>>
>> ffprobe of a typical MKV input file:
>> http://ix.io/kLm
>>
>> The ffmpeg log:
>> http://ix.io/kMw
>>
>> Sidenote: Found I had to put in a frame rate of 30 else things
>> wouldn't work. Really not sure why. Maybe someone can explain?
>>
>> Example of the input:
>> http://s.natalian.org/2015-09-13/MDalarm_20150911_121823.mkv
>>
>>
> First off, the command you used, from start to finish would be helpful,
> but seeing as this looks like a pretty easy one...
>

My apologies: just saw your command line in one of your files:
" Command line:
ffmpeg -y -i
/srv/ftp/888/C1_00626E587B70/record/MDalarm_20150913_115258.mkv -r 30
-movflags +faststart -pix_fmt yuv420p -c:v libx264 -vprofile baseline
-acodec aac -strict experimental
/srv/www/nuc.local/2015-09-13/MDalarm_20150913_115258.mp4"


> I downloaded your sample file above, and did:
>
> steve at steve-laptop:~/Downloads$ ffmpeg -i MDalarm_20150911_121823.mkv
> -c:a copy -c:v copy MDalarm.mp4
> ffmpeg version 2.4.git Copyright (c) 2000-2014 the FFmpeg developers
>   built on Nov 16 2014 15:41:37 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
>   configuration: --prefix=/home/steve/ffmpeg_build
> --extra-cflags=-I/home/steve/ffmpeg_build/include
> --extra-ldflags=-L/home/steve/ffmpeg_build/lib --bindir=/home/steve/bin
> --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
> --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
> --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
>   libavutil      54. 13.100 / 54. 13.100
>   libavcodec     56. 12.101 / 56. 12.101
>   libavformat    56. 13.100 / 56. 13.100
>   libavdevice    56.  3.100 / 56.  3.100
>   libavfilter     5.  2.103 /  5.  2.103
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, mpeg, from 'MDalarm_20150911_121823.mkv':
>   Duration: 00:00:33.73, start: 48716.884478, bitrate: 266 kb/s
>     Stream #0:0[0x1e0]: Video: h264 (Baseline), yuv420p, 1280x720, 90k
> tbr, 90k tbn
> Output #0, mp4, to 'MDalarm.mp4':
>   Metadata:
>     encoder         : Lavf56.13.100
>     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720,
> q=2-31, 90k tbn, 90k tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> frame=  778 fps=0.0 q=-1.0 Lsize=    1081kB time=00:00:33.68 bitrate=
> 262.8kbits/s
> video:1071kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 0.909946%
> steve at steve-laptop:~/Downloads$
>
> ls -l returns...
> -rw-r----- 1 steve steve 1122988 Sep 12 23:07 MDalarm_20150911_121823.mkv
> -rw-rw-r-- 1 steve steve 1106527 Sep 12 23:09 MDalarm.mp4
>
> I left out the part about "-c:a copy -c:v copy" to copy the streams and it
> yelled at me about framerate (tries to output a funky framerate) and also
> about the filesize was crazy.
>
> Put the "-c:a copy -c:v copy" to copy the streams and not transcode and it
> worked fast (778 fps) and plays fine with ffplay and VLC. MPlayer plays it
> at an insane FPS. Stats on the resulting file:
>
> steve at steve-laptop:~/Downloads$ ffprobe MDalarm.mp4
> ffprobe version 2.4.git Copyright (c) 2007-2014 the FFmpeg developers
>   built on Nov 16 2014 15:41:37 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
>   configuration: --prefix=/home/steve/ffmpeg_build
> --extra-cflags=-I/home/steve/ffmpeg_build/include
> --extra-ldflags=-L/home/steve/ffmpeg_build/lib --bindir=/home/steve/bin
> --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
> --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
> --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
>   libavutil      54. 13.100 / 54. 13.100
>   libavcodec     56. 12.101 / 56. 12.101
>   libavformat    56. 13.100 / 56. 13.100
>   libavdevice    56.  3.100 / 56.  3.100
>   libavfilter     5.  2.103 /  5.  2.103
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
>   libpostproc    53.  3.100 / 53.  3.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MDalarm.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf56.13.100
>   Duration: 00:00:33.73, start: 0.000000, bitrate: 262 kb/s
>     Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p,
> 1280x720, 260 kb/s, 23.06 fps, 25 tbr, 90k tbn, 180k tbc (default)
>     Metadata:
>       handler_name    : VideoHandler
> steve at steve-laptop:~/Downloads$
>
> My version of FFmpeg (which I admit is a little older than newest
> development) puts it in a 24000/1001 framerate H264 video stream and copies
> it nicely into an MP4 file. iOS devices shouldn't have any problem playing
> a 720P .MP4.
>
> TL;DR: use -c:a copy and -c:v copy options and give that a shot.
>
>
>> Many thanks,
>>
>> p.s. code for the project will eventually land up in
>> https://github.com/kaihendry/camftp2web
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>
>


More information about the ffmpeg-user mailing list