Hello everybody
I'm trying to re-encode an MPEG-2 file using this command (to keep all the original movie characteristics except for the video bitrate, that I want to decrease):
but FFmpeg doesn't start the conversion and immediately stops with this error:ffmpeg -i input.mpg" -c copy -b:v 700k output.mpg
The complete log is here:av_interleaved_write_frame(): Invalid argument
Here you find the input movie characteristics read by MediaInfo:ffmpeg -i "J:\input.mpg" -c copy -b:v 700k "J:\output.mpg"
ffmpeg version N-44601-gcb3591e Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 19 2012 16:28:01 with gcc 4.7.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 56.100 / 54. 56.100
libavformat 54. 27.101 / 54. 27.101
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 16.104 / 3. 16.104
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 003fbf00] max_analyze_duration 5000000 reached at 5016000
Input #0, mpeg, from 'J:\input.mpg':
Duration: 00:00:21.16, start: 0.097422, bitrate: 3954 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 3550 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Output #0, mpeg, to 'J:\output.mpg':
Metadata:
encoder : Lavf54.27.101
Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 3550 kb/s, 25 fps, 90k tbn, 25 tbc
Stream #0:1: Audio: mp2, 48000 Hz, stereo, 384 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpeg @ 03394440] pts (30104) < dts (36264) in stream 0
av_interleaved_write_frame(): Invalid argument
Thank you very much for your help!General
Complete name : J:\ALIDVR\2012-10-02.18.44.06-DEEJAY TV-443\000.MPG
Format : MPEG-PS
File size : 9.98 MiB
Duration : 20s 870ms
Overall bit rate : 4 010 Kbps
Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=12
Duration : 20s 870ms
Bit rate : 3 550 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Active Format Description : Letterbox 16:9 image
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.342
Stream size : 8.83 MiB (88%)
Audio
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Emphasis : 50/15ms
Duration : 20s 625ms
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -335ms
Stream size : 967 KiB (9%)
Menu
![]()
+ Reply to Thread
Results 1 to 6 of 6
-
Last edited by falco2000; 2nd Oct 2012 at 14:59.
Falco2000, video newbie.
Let's everyone help each other. -
AFAIK "-c:v copy" will just copy video stream, without a change. if you want to change bitrate, try changing
ffmpeg -i input.mpg" -c copy -b:v 700k output.mpg
ffmpeg -i input.mpg" -vcodec mpeg2video -b:v 700k output.mpg -
Thanks for your answer ozok.
That's probably the right explanation and I was mistaking, but I've read on the FFmpeg documentation page this:
For each stream, the last matching c option is applied, so
ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
will copy all the streams except the second video, which will be encoded with libx264, and the 138th audio, which will be encoded with libvorbis.
The error happens with this too:
Anyway, I still have the same problem: you say to use
and this creates a movie that has all characteristics of the input movie except for the video bitrate (and that's ok) but also produces these changes (seen with MediaInfo):
OUTPUT MOVIE:
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=12
Scan type : Interlaced
Scan order : Top Field First
Format settings, BVOP : No
Format settings, Matrix : Default
Format settings, GOP : M=1, N=12
Scan type : Progressive
How can I do?
I searched in the FFmpeg documentation page and maybe:
- the scan type and order could be kept with the setfield filter as explained in the FFmpeg documentation, although I still have to learn how to exactly use it
- the GOP could be set with the -g option but in the documentation examples its argument is always only ONE, not two, as MediaInfo shows ("M=3, N=12"). How should I set "M" and "N" if I can specify one number only?
- I didn't find any understandable hint for "Matrix". Is that the "colormatrix" cited in the documentation? Surely - I think - it's not the matrix of the unsharp filter or the matrix related to the audio encoding (also mentioned in the documentation page). So what are these "Matrix: default" and "Matrix: custom"?
- I didn't find reference to "BVOP" in the main documentation page. Maybe is something that has to be set using a private option of the MPEG2VIDEO codec, as said in the documentation?
Private options are listed under their corresponding containers/devices/codecs.
Thank you all for your precious helpLast edited by falco2000; 3rd Oct 2012 at 16:02.
Falco2000, video newbie.
Let's everyone help each other. -
@falco2000 again i am not sure, but characteristics of input and output differ because of bitrate change. I am not sure but ffmpeg might be deciding proper settings for mpeg2 codec based on given bitrate because you did not specify them yourself manually. but that might be completely false so you must set a bitrate value close to input's and see what happens. also ffmpeg seems to be doing deinterlacing, so you might want to turn that off too.
i do not have knowledge about mpeg2video specific options. -
I did several tests, also with a bitrate similar to the original, but the output movie is still not interlaced as the input.
So I tried the ilme filter to keep/force the interlace format:
ffmpeg -i input.mpg -c:v mpeg2video -b:v 15000k -flags:v ilme -c:a copy output.mpg
Scan type : Interlaced
Scan order : Top Field First
So I guess I should match the other characteristics (Matrix, GOP and BVOP) too. But how?Last edited by falco2000; 3rd Oct 2012 at 16:07.
Falco2000, video newbie.
Let's everyone help each other. -
looking at the manual (http://ffmpeg.org/ffmpeg.html)
gop size can be set with '-g X', where X is the size of the gop
bvop specifies whether or not b-frames are used, the b-frame count can be set with '-bf X', where X is the number of consecutive b-frames, using -bf 0 should disable the use of b-frames
not sure about the matrix but it might help to specify '-target type' (see manual for possible type values)
Similar Threads
-
Help. Avisynth Error Message "no function named limitedsharpen"
By Pitorasilo in forum Video ConversionReplies: 7Last Post: 27th Dec 2010, 07:13 -
"there is a problem with your sound hardware." error message
By arconreef in forum AudioReplies: 1Last Post: 8th Nov 2010, 15:58 -
ffmpeg GUI that can "copy" into a different container?
By AlanHK in forum Video ConversionReplies: 4Last Post: 22nd Jul 2010, 03:37 -
Help. Avisynth Error Message "no function named deblock"
By hypnoticpimp in forum Video ConversionReplies: 13Last Post: 28th Sep 2008, 00:45 -
DVD Flick error message "ffmpeg.exe has stopped working"
By stewiegriffin711 in forum Authoring (DVD)Replies: 4Last Post: 17th Aug 2008, 08:20