1

I use xmedia recode, which uses ffmpeg, to convert these videos using "copy" video and "convert" ac3 -> aac, with an mp4 container. For most videos this works fine, and is really fast. However some show up as "motion jpeg", and when I convert them I'm given a small file with the audio and a black screen. In VLC they show up as h264/ac3 under codec information.

I tried tencoder with ffmpeg and got the same results. However if I switch the tencoder's encoder to mencoder, the videos come out fine. The problem is they take 30 minutes each, whereas ffmpeg copying in xmedia takes 2 minutes. Is there a way I can strip these videos of their "motion jpeg"-ness?

Here is the log:

Encoder 1 log
Encoder 1 command lines:
 -y  -itsoffset 0 -threads 8  -i "Z:\Downloads\3. Convert\test.mkv"     -c:v libx264  -crf 21   -level 41  -f mp4  -map 0:2 -map 0:1  -strict experimental -c:a aac -ab 320k  -af aresample=resampler=soxr -ar 44100 -ac 2    "Z:\Downloads\3. Convert\test.mp4"

Encoder 1 console outputs:
ffmpeg version N-71403-g415f1fa Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 22.101 / 54. 22.101
  libavcodec     56. 34.100 / 56. 34.100
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 13.101 /  5. 13.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'Z:\Downloads\3. Convert\test.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.1
    creation_time   : 2015-01-16 07:42:24
  Duration: 00:20:18.47, start: 0.083000, bitrate: 4818 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 2k tbc (default)
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Stream #0:2: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 340x340 [SAR 300:300 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      filename        : cover.jpeg
      mimetype        : image/jpeg
[mp4 @ 00000000027008e0] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
No pixel format specified, yuvj444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000003d4f020] using SAR=1/1
[libx264 @ 0000000003d4f020] MB rate (43560000) > level limit (245760)
[libx264 @ 0000000003d4f020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
[libx264 @ 0000000003d4f020] profile High 4:4:4 Predictive, level 4.1, 4:4:4 8-bit
[libx264 @ 0000000003d4f020] 264 - core 146 r2538 121396c - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=4 threads=12 lookahead_threads=2 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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=21.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'Z:\Downloads\3. Convert\test.mp4':
  Metadata:
    encoder         : Lavf56.30.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj444p(pc), 340x340 [SAR 300:300 DAR 1:1], q=-1--1, 90k fps, 90k tbn, 90k tbc
    Metadata:
      filename        : cover.jpeg
      mimetype        : image/jpeg
      encoder         : Lavc56.34.100 libx264
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 320 kb/s (default)
    Metadata:
      encoder         : Lavc56.34.100 aac
Stream mapping:
  Stream #0:2 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=31.0 Lsize=   47681kB time=00:20:18.40 bitrate= 320.6kbits/s    
video:10kB audio:47281kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.825254%
[libx264 @ 0000000003d4f020] frame I:1     Avg QP:31.31  size:  9546
[libx264 @ 0000000003d4f020] mb I  I16..4:  7.0% 77.1% 15.9%
[libx264 @ 0000000003d4f020] 8x8 transform intra:77.1%
[libx264 @ 0000000003d4f020] coded y,u,v intra: 48.1% 11.9% 10.3%
[libx264 @ 0000000003d4f020] i16 v,h,dc,p: 12% 21% 21% 47%
[libx264 @ 0000000003d4f020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32%  9% 32%  3%  4%  5%  4%  5%  6%
[libx264 @ 0000000003d4f020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23%  9% 21%  8%  7% 10%  6% 10%  6%
[libx264 @ 0000000003d4f020] kb/s:6873120.00
0

2 Answers 2

1

The problem

The issue is your usage of -map. You're telling ffmpeg to map steams 0:2 and 0:1 which in this input correspond to the aac audio stream and the mjpeg video stream.

Solutions

Use the default stream selection

You can omit the -map options and rely on the default stream selection behavior:

By default, ffmpeg includes only one stream of each type (video, audio, subtitle) present in the input files and adds them to each output file. It picks the "best" of each based upon the following criteria:

  • video – the stream with the highest resolution
  • audio – the stream with the most channels
  • subtitles – the first subtitle stream

In the case where several streams of the same type rate equally, the stream with the lowest index is chosen.

Use proper mapping

If the default stream selection is not acceptable for you then you'll have to use the correct -map options for each input.

A better method than explicitly selecting a particular stream by index number is to add a stream specifier.

Examples

  1. Choose all video streams and all audio streams from the first (and only) input:

    ffmpeg -i input0 -map 0:v -map 0:a … output
    
    • Note that ffmpeg starts counting from 0.
  2. Choose the first video stream from the second input and the third audio stream from the first input:

    ffmpeg -i input0 -i input1 -map 1:v:0 -map 0:a:2 … output
    
  3. Use a negative mapping to choose all streams from input 0 except any subtitle streams:

    ffmpeg -i input0 -map 0 -map -0:s … output
    

Also see

0

Open the mkv in mkvmerge, check if it has attachments and if it does, remove them, mux and try converting again. Attachments is the only thing I have encountered that cause an mkv to display as "motion jpeg" in Xmedia recode.

You must log in to answer this question.

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