VideoHelp Forum




+ Reply to Thread
Results 1 to 19 of 19
  1. Well, I do not really need to convert the whole files, just parts of them.

    I know someone will recommend other codecs, I've tried a lot of them, but mjpeg is the only one which works here. Virtualdub just can't work here, since it just generates black videos.

    The only way I've managed to do that kind of conversion was using Vegas to render parts of the videos I needed as mjpeg. This introduces some other problems to the files, though.

    Please help me, I just can't manage to do it in a simple/quick way. Programs like AviSynth or ffdshow seem too complicated, I have no idea about how to use them. Beside that, they don't seem to be able to convert just parts of the files.

    My main goal is converting files to i-frame intermediates to edit them on Vegas. Preferentially, some way which will allow me to convert just the parts I need, so I don't get gigantic files.

    P.S.: Yes, I need to keep the audio, and it has to be compatible with Vegas as well.
    Last edited by Clever Sleazoid; 11th Oct 2015 at 09:01. Reason: I had to be more specific
    Quote Quote  
  2. Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -an -y %1.avi
    Quote Quote  
  3. Thanks, it works well, but the resulting video has no audio. I actually need the audio as well

    Since the thread could be misleading, I've edited it to be more specific
    Quote Quote  
  4. Instead of -an, use -c:a copy to keep the audio as the original

    If the source audio is incompatible in AVI container, convert it to PCM wave

    -c:a pcm_s16le

    To convert a segment, you can use either -vf trim to specify a segment; or -t for duration and -ss for start time
    Quote Quote  
  5. Oh, thanks again. So... I got only 3 more questions:

    1. So the code stays like that, right?

    Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -c:a copy -y %1.avi
    2. Please, how do I insert the command to convert a segment in that code I've just written? (for example, if the video has 20 min, but I just want the segment between 11:22 and 13:47)

    3. Isn't PCM Wave too heavy to work with little space on HD? Wouldn't it be easier to convert it to MP3 (which is still compatible with Vegas)? How do I do that using that code?
    Last edited by Clever Sleazoid; 11th Oct 2015 at 10:38.
    Quote Quote  
  6. Originally Posted by Clever Sleazoid View Post
    Oh, thanks again. So... I got only 3 more questions:

    1. So the code stays like that, right?

    Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -c:a copy -y %1.avi
    2. Please, how do I insert the command to convert a segment in that code I've just written? (for example, if the video has 20 min, but I just want the segment between 11:22 and 13:47)

    3. Isn't PCM Wave too heavy to work with little space on HD? Wouldn't it be easier to convert it to MP3 (which is still compatible with Vegas)? How do I do that using that code?



    yes, if it's compatible source audio, copy will work. 16bit pcm wave for stereo is only 1536kb/s

    -c:a libmp3lame if you want mp3. It's lossy. It only supports stereo. -b:a for bitrate e.g. -b:a 192k would be 192kbps. If you use high enough bitrate it might be ok e.g. 320kbps

    hh:mm: ss.ms is the notation
    -ss 00:11:22 means start time at 11min 22sec
    -t 00:01:25 means duration is 1min 25sec (if you add 1min 25sec to 11min 22sec you get 13:47)
    Quote Quote  
  7. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    If your situation is such that your hard drives have a problem with LPCM/WAV audio, it's a lot more serious than you're letting on and you shouldn't even be trying to mess with HD video, compressed or not.

    Scott
    Quote Quote  
  8. You should definitely look into adding more HDD's. 500GB isn't enough if your profile is up to date

    If you're not keen on the ffmpeg commandline stuff, xmediarecode is a GUI for ffmpeg that has a filter/preview tab which allows you to mark in/ mark out segments

    If you learn a bit of avisynth, you can frameserve scripts into vegas using avfs (avisynth virtual frame server) . If the script is indexed, it will be frame accurate (like I-frame), and it will only take a few kb instead of a large intermediate file. (A script is essentially a text file).
    Quote Quote  
  9. So the correct code for our example would be

    Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -ss 00:11:22 -t 00:01:25 -c:a copy -y %1.avi
    right?

    Or in case of mp3:

    Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -ss 00:11:22 -t 00:01:25 -c:a libmp3lame -b:a 128k -y %1.avi
    Are those right?

    Sorry, I have no money to invest in more HDDs right now.

    I actually use an internal 500 GB HD and an external 1 TB HD. In fact, they are not empty, but I've got rid of some stuff recently, so I have more space now. The problem is that this time I'll need to work with a lot of files (30 or 40 segments of videos, maybe more). That's because I want to be safe with HD space. Not all videos have really good quality or really good audios, so it's because of that I don't care about using lossy audios. I just want the frames stay in their place (i.e., i-frame).

    I'll try xmediarecode later
    Last edited by Clever Sleazoid; 11th Oct 2015 at 12:34.
    Quote Quote  
  10. Originally Posted by Clever Sleazoid View Post
    So the correct code for our example would be

    Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -ss 00:11:22 -t 00:01:25 -c:a copy -y %1.avi
    right?

    Or in case of mp3:

    Code:
    ffmpeg.exe -i %1 -c:v mjpeg -q:v 2 -dc 8 -ss 00:11:22 -t 00:01:25 -c:a libmp3lame -b:a 128k -y %1.avi
    Are those right?

    Sorry, I have no money to invest in more HDDs right now.

    I actually use an internal 500 GB HD and an external 1 TB HD. In fact, they are not empty, but I've got rid of some stuff recently, so I have more space now. The problem is that this time I'll need to work with a lot of files (30 or 40 segments of videos, maybe more). That's because I want to be safe with HD space. Not all videos have really good quality or really good audios, so it's because of that I don't care about using lossy audios. I just want the frames stay in their place (i.e., i-frame).

    I'll try xmediarecode later
    IMHO -ss 00:11:22 should before input i.e. -i %1 so
    Code:
    ffmpeg.exe -ss 00:11:22 -i %1 -t 00:01:25 -c:v mjpeg -q:v 2 -dc 8 -c:a ...
    Quote Quote  
  11. Thank you all.

    I must say that xmediarecode is a great program for my purposes. The problem is that the resulting mjpeg video has lower quality than the original, what does not make sense for me. Yes, I keep the "Framerate" option as "Keep original" in the Video tab.

    Do you have any idea about why is it happening? Is there any option I should change in order to keep the quality?
    Last edited by Clever Sleazoid; 12th Oct 2015 at 21:13.
    Quote Quote  
  12. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    So that we can be on the same page and not guess, you could post the MediaInfo text readouts of the sources and target clips. Only way to go beyond that is if you uploaded clip samples. And encoder logs.

    Scott
    Quote Quote  
  13. mjpeg isn't a lossless codec - you always lose quality.

    Set the quantizer to 2 as before in ffmpeg , and it should give the same quality loss as when you used ffmpeg (xmediarecode is a ffmpeg GUI)
    Quote Quote  
  14. 1. Gakkou no Kaidan Video


    1.1. Gakkou no Kaidan original file

    General
    Complete name : C:\Users\User\Desktop\Gakkou no Kaidan (ep.02).mp4
    Format : MPEG-4
    Format profile : Base Media
    Codec ID : isom
    File size : 80.4 MiB
    Duration : 23mn 37s
    Overall bit rate mode : Variable
    Overall bit rate : 476 Kbps
    Encoded date : UTC 2010-10-10 18:01:01
    Tagged date : UTC 2010-10-10 18:01:01

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L5.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 4 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 23mn 37s
    Bit rate : 410 Kbps
    Maximum bit rate : 1 558 Kbps
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Constant
    Frame rate : 29.970 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.045
    Stream size : 70.5 MiB (88%)
    Title : Imported with GPAC 0.4.6-DEV (internal rev. 5)
    Writing library : x264 core 104 r1713 c276662
    Encoding settings : 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=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=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=abr / mbtree=1 / bitrate=410 / ratetol=0.0 / qcomp=0.00 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    Encoded date : UTC 2010-10-10 18:01:01
    Tagged date : UTC 2010-10-10 18:01:14

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 23mn 17s
    Bit rate mode : Variable
    Bit rate : 55.0 Kbps
    Maximum bit rate : 60.8 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Stream size : 9.17 MiB (11%)
    Encoded date : UTC 2010-10-10 18:01:12
    Tagged date : UTC 2010-10-10 18:01:14




    1.2. Gakkou no Kaidan segment copy

    General
    Complete name : C:\Users\User\Videos\Intermediates\Gakkou no Kaidan (ep.02) segment copy.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 2.75 MiB
    Duration : 46s 630ms
    Overall bit rate : 494 Kbps
    Writing application : Lavf57.3.100

    Video
    ID : 0
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L5.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 4 frames
    Codec ID : avc1
    Duration : 46s 630ms
    Bit rate : 417 Kbps
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate : 59.940 fps
    Original frame rate : 29.970 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.023
    Stream size : 2.32 MiB (84%)

    Audio
    ID : 1
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : FF
    Duration : 46s 592ms
    Bit rate : 55.0 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Stream size : 312 KiB (11%)
    Alignment : Split accross interleaves
    Interleave, duration : 21 ms (1.28 video frame)
    Interleave, preload duration : 22 ms

    1.3. Gakkou no Kaidan segment converted to mjpeg

    General
    Complete name : C:\Users\User\Videos\Intermediates\Gakkou no Kaidan (ep.02) segment converted to mjpeg.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 16.1 MiB
    Duration : 45s 312ms
    Overall bit rate : 2 983 Kbps
    Writing application : Lavf57.3.100

    Video
    ID : 0
    Format : JPEG
    Codec ID : MJPG
    Duration : 45s 312ms
    Bit rate : 2 840 Kbps
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate : 29.970 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.308
    Stream size : 15.3 MiB (95%)

    Audio
    ID : 1
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 3
    Codec ID : 55
    Codec ID/Hint : MP3
    Duration : 45s 296ms
    Bit rate mode : Constant
    Bit rate : 128 Kbps
    Channel(s) : 2 channels
    Sampling rate : 44.1 KHz
    Compression mode : Lossy
    Stream size : 708 KiB (4%)
    Alignment : Aligned on interleaves
    Interleave, duration : 26 ms (0.78 video frame)
    Interleave, preload duration : 78 ms



    2. Cinderella Boy Video


    2.1. Cinderella Boy original file

    General
    Complete name : C:\Users\User\Desktop\Cinderella Boy (ep.09).avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 151 MiB
    Duration : 24mn 35s
    Overall bit rate : 861 Kbps
    Writing application : VirtualDubMod 1.5.10.2 (build 2540/release)
    Writing library : VirtualDubMod build 2540/release

    Video
    ID : 0
    Format : MPEG-4 Visual
    Format profile : Advanced Simple@L5
    Format settings, BVOP : 2
    Format settings, QPel : No
    Format settings, GMC : No warppoints
    Format settings, Matrix : Default (H.263)
    Muxing mode : Packed bitstream
    Codec ID : XVID
    Codec ID/Hint : XviD
    Duration : 24mn 35s
    Bit rate : 724 Kbps
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Original display aspect ratio : 4:3
    Frame rate : 25.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.094
    Stream size : 127 MiB (84%)
    Writing library : XviD 1.2.0.dev47 (UTC 2006-11-01)

    Audio
    ID : 1
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 3
    Codec ID : 55
    Codec ID/Hint : MP3
    Duration : 24mn 35s
    Bit rate mode : Constant
    Bit rate : 128 Kbps
    Channel(s) : 2 channels
    Sampling rate : 44.1 KHz
    Compression mode : Lossy
    Stream size : 22.5 MiB (15%)
    Alignment : Aligned on interleaves
    Interleave, duration : 40 ms (1.00 video frame)
    Interleave, preload duration : 522 ms
    Writing library : LAME3.93


    2.2. Cinderella Boy segment copy

    General
    Complete name : C:\Users\User\Videos\Intermediates\Cinderella Boy (ep.09) segment copy.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 4.38 MiB
    Duration : 40s 760ms
    Overall bit rate : 901 Kbps
    Writing application : Lavf57.3.100

    Video
    ID : 0
    Format : MPEG-4 Visual
    Format profile : Advanced Simple@L5
    Format settings, BVOP : 2
    Format settings, QPel : No
    Format settings, GMC : No warppoints
    Format settings, Matrix : Default (H.263)
    Muxing mode : Packed bitstream
    Codec ID : XVID
    Codec ID/Hint : XviD
    Duration : 40s 760ms
    Bit rate : 759 Kbps
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Original display aspect ratio : 4:3
    Frame rate : 25.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.099
    Stream size : 3.69 MiB (84%)
    Writing library : XviD 1.2.0.dev47 (UTC 2006-11-01)

    Audio
    ID : 1
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 3
    Codec ID : 55
    Codec ID/Hint : MP3
    Duration : 40s 751ms
    Bit rate mode : Constant
    Bit rate : 128 Kbps
    Channel(s) : 2 channels
    Sampling rate : 44.1 KHz
    Compression mode : Lossy
    Stream size : 635 KiB (14%)
    Alignment : Aligned on interleaves
    Interleave, duration : 26 ms (0.65 video frame)
    Interleave, preload duration : 52 ms
    Writing library : LAME3.93

    2.3. Cinderella Boy segment converted to mjpeg

    General
    Complete name : C:\Users\User\Videos\Intermediates\Cinderella Boy (ep.09) segment converted to mjpeg.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    File size : 10.5 MiB
    Duration : 35s 520ms
    Overall bit rate : 2 469 Kbps
    Writing application : Lavf57.3.100

    Video
    ID : 0
    Format : JPEG
    Codec ID : MJPG
    Duration : 35s 520ms
    Bit rate : 2 326 Kbps
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate : 25.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Compression mode : Lossy
    Bits/(Pixel*Frame) : 0.303
    Stream size : 9.85 MiB (94%)

    Audio
    ID : 1
    Format : MPEG Audio
    Format version : Version 1
    Format profile : Layer 3
    Codec ID : 55
    Codec ID/Hint : MP3
    Duration : 35s 500ms
    Bit rate mode : Constant
    Bit rate : 128 Kbps
    Channel(s) : 2 channels
    Sampling rate : 44.1 KHz
    Compression mode : Lossy
    Stream size : 555 KiB (5%)
    Alignment : Aligned on interleaves
    Interleave, duration : 26 ms (0.65 video frame)
    Interleave, preload duration : 26 ms

    I got 2 examples to show you what's happening.

    I've used xmediarecode to get segments from the original files.

    1.1 and 2.1 are the original files (they were not attached, since they are big, and I think it's not useful to do that)

    1.2 and 2.2 (those ones named as "segment copy") were just unconverted segments of the original files.
    ( using these settings of xmediarecode:
    https://forum.videohelp.com/images/imgfiles/OvNcVaJ.jpg
    https://forum.videohelp.com/images/imgfiles/W7YvYE6.jpg )

    1.3 and 2.3 (those ones named as "segment converted to mjpeg") were basically the same segments converted to mjpeg files which should work as intermediate files for my editings.
    ( using these settings of xmediarecode:
    https://forum.videohelp.com/images/imgfiles/eBiFPYH.jpg
    https://forum.videohelp.com/images/imgfiles/TSSenUf.jpg )

    1.2, 1.3, 2.2 and 2.3 were attached to this post.

    As you can see, 1.3 and 2.3 are very different from 1.2 and 2.2, since 1.3 and 2.3 got lower quality than the original ones. That's strange for me. I'd like my mjpeg intermediates to be similar to the original ones.

    Since I'll still have to do that same process with over 30 or 40 files (with many different codecs, formats and containers) to do my editings and I don't have much time, I'd really like to know what's going wrong, what I got to do.

    Please help me. I don't have much experience, I must be overseeing some crucial settings of xmediarecode.
    Quote Quote  
  15. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    1st glance w/o looking at the clips:
    On that 1st clip you go from 29.97 to 59.94 to 29.97!
    And ~400kbps to ~2500. But mjpeg is not efficient for even that bump up. Remember, even though it is usually vbr it is (or ought to be/considered) equivalent in coding efficiency to DV. Dv is 25mbps, not 2.5, so if you are using 2.5 as your mjpeg vbr average, you are off by a whole order of magnitude.

    Scott
    Quote Quote  
  16. in the mjpeg configuration , you have quality set to 20, not 2. I think that's supposed to be "quantizer" . If it is, lower quantizer values yield higher quality, higher filesizes . Pick a value that you can live with in terms of quality vs. filesize

    https://forum.videohelp.com/images/imgfiles/eBiFPYH.jpg
    Quote Quote  
  17. Set quality (not quantizer) to something around 90% (9.0?). Anything lower than 75% is easily perceived in JPEG/MJPEG (at least for me)
    Quote Quote  
  18. Originally Posted by Clever Sleazoid View Post
    Virtualdub just can't work here, since it just generates black videos.
    Use the ffmpeg source plugin for VirtualDub. Force it in the Open Video File dialog with the Files Of Type pulldown.

    Click image for larger version

Name:	open.png
Views:	373
Size:	41.3 KB
ID:	34036
    Quote Quote  
  19. Thanks. I'll try to see what's going wrong with VirtualDub later, when I'll have finished my job.

    And thanks again, since I've set quality to 2, xmediarecode worked like a charm, just as I needed. Just one more question: can't xmediarecode convert segments with their respective external subtitles (in their respective places)? Or will I only be able to manually insert the subtitles for the intended part by myself?

    I'm asking that because I've tried to include subtitles in the conversion, but it was just able to attach the whole subtitles. So, for example, if I need to convert the segment between 5:00 and 6:00 from a 20 min video, I'll get subtitles from 0:10, 0:14... 0:26... not the subtitles which correspond to the segment I want (5:00~6:00)
    Last edited by Clever Sleazoid; 15th Oct 2015 at 02:07.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!